The webpage can pass variables to flash through the SWF address and pass them as value pairs, as shown below:
<Object classid = "CLSID: d27cdb6e-ae6d-11cf-96b8-444553540000"
Id = "loaderinfosample" width = "100%" Height = "100%"
Codebase = "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<Param name = "movie" value = "loaderinfosample.swf? A = 1 & B = 2 "/>
<Param name = "quality" value = "high"/>
<Param name = "bgcolor" value = "#869ca7"/>
<Param name = "allowScriptAccess" value = "samedomain"/>
<Embed src = "loaderinfosample.swf? A = 1 & B = 2 "Quality =" high "bgcolor =" #869ca7"
Width = "100%" Height = "100%" name = "loaderinfosample" align = "Middle"
Play = "true"
Loop = "false"
Quality = "high"
AllowScriptAccess = "samedomain"
Type = "application/X-Shockwave-flash"
Pluginspage = "http://www.adobe.com/go/getflashplayer">
</Embed>
</Object>
In actionsrippt2, the two variables passed in can be directly referenced at the first frame.
As3 abandons this nonstandard usage and agrees to use the parameter attribute of loaderinfo to complete the process.
Loaderinfo help documentation see: http://livedocs.macromedia.com/L... lay/loaderinfo.html
The loaderinfo class is specially designed to save the loading information of SWF, images, or any other displayobject.
The SwF parameter is also part of the loading information. It can be obtained through the parameters attribute of loaderinfo. The result is an array and its value can be traversed through for... in.
The sample code is as follows:
Package org. flashbbs. Sample
{
Import flash. display. movieclip;
Import flash. display. loaderinfo;
Import flash. Text. textfield;
Public class loaderinfosample extends movieclip
{
Public Function loaderinfosample (){
Var key: string;
VaR value: string;
VaR text1: textfield = new textfield ();
Addchild (text1 );
VaR Param: Object = This. Root. loaderinfo. parameters;
For (Key In Param ){
Value = string (Param [Key]);
Text1.appendtext (Key + "=" + value );
}
}
}
}
Note that loaderinfo belongs to the as3 class. If Flash contains the code of AS1 or As2, it cannot retrieve the value and can only retrieve null.