In AS2, you can add parameters to the end of flash, for example, demo.swf? U1 = good & u2 = bad
In flash, u1 and u2 are the root variables by default. You can use _ root. u1 and _ root. u2 to obtain the value.
But in as3.
To use the parameters attribute of the flash. display. loaderInfo class, a parameter object is returned.
Usage:
For example, defining var param: Object = root. loaderInfo. parameters in the document class;
If the value of u1 is obtained, you can use param ["u1"], and the same u2 value: param ["u2"]
The document class is as follows:Package{
Import Flash.Display.Sprite;
Import Flash.Display.Stage;
Import Flash.Display.StageScaleMode;
Import Flash. Text.TextField;
Import Flash. Text.TextFieldAutoSize;
PublicClass LoaderInfoDemoExtends Sprite{
Public FunctionLoaderInfoDemo (){
Stage. scaleMode =StageScaleMode. NO_SCALE;
VarOut_txt:TextField= CreateText ();
Out_txt.border =True;
Out_txt.borderColor = 0xFF6600;
Out_txt.y = 20;
AddChild (out_txt );
VarInfo_txt:TextField= CreateText ();
Info_txt.text = "Modify loaderinfodemo.swf? Msg = xxx value in xxx, and then press ENTER ";
Info_txt.autoSize =TextFieldAutoSize. LEFT;
AddChild (info_txt );
VarParam:Object= Root. loaderInfo. parameters;
If(Param ["msg"]! =Null){
Out_txt.text = param ["msg"];
Trace("Value:" + param ["msg"]);
}Else{
Out_txt.text = "null ";
Trace("Value: null ");
}
}
Private FunctionCreateText ():TextField{
VarTmp:TextField=New TextField();
Tmp. selectable =False;
Tmp. width = 100;
Tmp. height = 20;
ReturnTmp;
}
}
}