Pages

Getting address variables into an Actionscript 3.0 flash file

In order to get your html address variables into Flash these are the steps you need to take. This solution assumes that you are embeding your flash file with SWFObject 1.5. Please note this is for SWFObject 1.5. SWFObject 2.0 uses and entirely different set of methods to embed and pass variables to the swf.
Step 1:
Embed your swf in the HTML doc
< script type="text/javascript" src="swfobject/swfobject.js" ></ script >

< script type="text/javascript" >
// <![CDATA[
var so = new SWFObject('testload.swf', 's-moderate', '100%', '100%', '10', '#222222');
so.addVariable('shirt', getQueryParamValue("shirt"));
so.useExpressInstall('swfobject/expressinstall.swf');
so.addParam('menu', 'false');
so.write('content');
// ]]>
< /script >


Step 2
Inside your AS3 document retrieve your variables like so

var myshirt:String = this.loaderInfo.parameters.shirt

That's it





aYo Binitie II

No comments:

Instagram