Simple use of swfobject. js 2.2

Source: Internet
Author: User

Official Website Introduction
Http://code.google.com/p/swfobject/wiki/documentation

Usage:
HTML section
<Div id = "swf1">... </div>
JS Section
Swfobject. embedswf ("test.swf", "swf1", "300", "120", "9.0.0 ",);

Source code:
This is the source code in 2.2. You can see how to use the parameters.
Embedswf: function (swfurlstr, replaceelemidstr, widthstr, heightstr, swfversionstr, xiswfurlstr, flashvarsobj, parobj, attobj, callbackfn ){

....}

Details
First, you need to understand the object tag.
Http://www.w3school.com.cn/tags/tag_object.asp
Http://www.w3school.com.cn/tags/tag_param.asp

Swfurlstr, replaceelemidstr, widthstr, heightstr, swfversionstr, xiswfurlstr
These are in sequence, SwF position, and HTML should be replaced with the flash element ID, width, height, and Flash version. If there is no flash, use this automatically installed FLASH file swfobject2.2 in the source file.

Flashvarsobj: the value of flashvars. This is often used as a parameter passed between HTML and Flash. It is originally an attribute in the Params object. It is obtained separately because of its common usage and convenience. It can be set to null. Then write In Param.

Param object attributes:
Detailed introduction to http://kb2.adobe.com/cps/127/tn_12701.html
Play, loop, menu, quality, scale, salign, bgcolor, base, swliveconnect, flahvars, devicefont, allowScriptAccess, seamlesstabbing, allowfullscreen, allownetworking
Wmode is very important,Window, opaque, transparent (usually setTransparentTransparent or opaque is not transparent ). If this parameter is not set, window is displayed by default. At this time, the object element will always be displayed at the top, and the click event will not be listened.

Attributes of the attributes object: ID, name, styleclass (do not use class, because class is also the reserved keyword of ecma4), align

Callbackfn: callback function

Demo
Demo 1

swfobject. embedswf ( "test6_flashvars.swf" , "content5" , "300" , "120" , "6.0.0" , "expressinstall.swf" , {name1: "hello" , name2: "world" , name3: "foobar" }, {menu: "false" }, {ID: "dynamiccontent5" , Name: "dynamiccontent5" });

Demonstration 2

VaR Flashvars = {
Name1:"Hello",
Name2:"World",
Name3:"Foobar"
};
VaR Params = {
Menu:"False"
};
VaR Attributes = {
ID:"Dynamiccontent2",
Name:"Dynamiccontent2"
};
Swfobject. embedswf ("Test6_flashvars.swf","Content2","300","120","6.0.0","Expressinstall.swf", Flashvars, Params, attributes );

Demonstration 3

var flashvars ={};
flashvars. xmlpath =
"data. XML " ;
var Params ={};
Params. wmode =
"Transparent" ;
var attributes ={};
swfobject. embedswf (
"xixi.swf" , "banner" , "960" , "250" , "9.0.0" , "expressinstall.swf" , flashvars, Params, attributes );

Demonstration 4

Swfobject. embedswf ("Gen_shu.swf","Gen_swf1","180","105","9.0.0",Null,Null, {Wmode:"Transparent"},Null,Function() {Alert ("Flash loaded successfully")});

 

JS call Method

Http://code.google.com/p/swfobject/wiki/api

Reprinted: http://www.cnblogs.com/lunalord/archive/2011/03/03/1967992.html

Official Website Introduction
Http://code.google.com/p/swfobject/wiki/documentation

Usage:
HTML section
<Div id = "swf1">... </div>
JS Section
Swfobject. embedswf ("test.swf", "swf1", "300", "120", "9.0.0 ",);

Source code:
This is the source code in 2.2. You can see how to use the parameters.
Embedswf: function (swfurlstr, replaceelemidstr, widthstr, heightstr, swfversionstr, xiswfurlstr, flashvarsobj, parobj, attobj, callbackfn ){

....}

Details
First, you need to understand the object tag.
Http://www.w3school.com.cn/tags/tag_object.asp
Http://www.w3school.com.cn/tags/tag_param.asp

Swfurlstr, replaceelemidstr, widthstr, heightstr, swfversionstr, xiswfurlstr
These are in sequence, SwF position, and HTML should be replaced with the flash element ID, width, height, and Flash version. If there is no flash, use this automatically installed FLASH file swfobject2.2 in the source file.

Flashvarsobj: the value of flashvars. This is often used as a parameter passed between HTML and Flash. It is originally an attribute in the Params object. It is obtained separately because of its common usage and convenience. It can be set to null. Then write In Param.

Param object attributes:
Detailed introduction to http://kb2.adobe.com/cps/127/tn_12701.html
Play, loop, menu, quality, scale, salign, bgcolor, base, swliveconnect, flahvars, devicefont, allowScriptAccess, seamlesstabbing, allowfullscreen, allownetworking
Wmode is very important,Window, opaque, transparent (usually setTransparentTransparent or opaque is not transparent ). If this parameter is not set, window is displayed by default. At this time, the object element will always be displayed at the top, and the click event will not be listened.

Attributes of the attributes object: ID, name, styleclass (do not use class, because class is also the reserved keyword of ecma4), align

Callbackfn: callback function

Demo
Demo 1

swfobject. embedswf ( "test6_flashvars.swf" , "content5" , "300" , "120" , "6.0.0" , "expressinstall.swf" , {name1: "hello" , name2: "world" , name3: "foobar" }, {menu: "false" }, {ID: "dynamiccontent5" , Name: "dynamiccontent5" });

Demonstration 2

VaR Flashvars = {
Name1:"Hello",
Name2:"World",
Name3:"Foobar"
};
VaR Params = {
Menu:"False"
};
VaR Attributes = {
ID:"Dynamiccontent2",
Name:"Dynamiccontent2"
};
Swfobject. embedswf ("Test6_flashvars.swf","Content2","300","120","6.0.0","Expressinstall.swf", Flashvars, Params, attributes );

Demonstration 3

var flashvars ={};
flashvars. xmlpath =
"data. XML " ;
var Params ={};
Params. wmode =
"Transparent" ;
var attributes ={};
swfobject. embedswf (
"xixi.swf" , "banner" , "960" , "250" , "9.0.0" , "expressinstall.swf" , flashvars, Params, attributes );

Demonstration 4

Swfobject. embedswf ("Gen_shu.swf","Gen_swf1","180","105","9.0.0",Null,Null, {Wmode:"Transparent"},Null,Function() {Alert ("Flash loaded successfully")});

 

JS call Method

Http://code.google.com/p/swfobject/wiki/api

Reprinted: http://www.cnblogs.com/lunalord/archive/2011/03/03/1967992.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.