When the page is passed through urlto upload the cursor (page.html? Id = 123 & name = aaa). You can use JavaScript to extract the string containing parameters from the URL in the HTML webpage that contains SWF, and send it to SwF in the form of flashvar, in Flex, you can directly use this. parameters. parameter Name to obtain the parameter value.
Sample:
HTML page code:
<HTML>
<Body>
<Script language = JavaScript>
Function writeflashobject (parastr ){
Document. write ("<object classid =" CLSID: d27cdb6e-ae6d-11cf-96b8-444553540000 "codebase =" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0 "width =" 550 "Height =" 400 "id =" flashvars "align =" Middle "> ");
Document. Write ("<Param name =" allowScriptAccess "value =" samedomain "/> ");
Document. Write ("<Param name =" movie "value =" uselib.swf "/> ");
Document. Write ("<Param name =" flashvars "value =" "+ parastr +" "/> ");
Document. Write ("<Param name =" quality "value =" high "/> ");
Document. Write ("<Param name =" bgcolor "value =" # ffffff "/> ");
Document. write ("<embed src =" uselib.swf "Quality =" high "bgcolor =" # ffffff "width =" 550 "Height =" 400 "name =" flashvars "align =" Middle "allowScriptAccess =" samedomain "flashvars =" "+ parastr +" "type =" application/X-Shockwave-flash "pluginspage =" http://www.macromedia.com/go/getflashplayer "/> ");
Document. Write ("</Object> ");
}
Function getparastr (){
VaR hrefstr, POs, parastr, para, tempstr1;
Hrefstr = Window. Location. href;
Pos = hrefstr. indexof ("? ")
Parastr = hrefstr. substring (Pos + 1 );
Return parastr;
}
VaR parastr = getparastr ();
Writeflashobject (parastr );
</SCRIPT>
</Body>
</Html>