Wednesday, January 06, 2010

FlashVars: sending variables into Flash from HTML/PHP

in HTML containing SWF:
...
AC_FL_RunContent(
...,
'flashVars','myVariable=<?php echo((isset($_GET['myVariable'])) ? $_GET['myVariable'] : ""); ?>'
); //end AC code

...
<param name="movie" value="live_stream.swf?myVariable=<?php echo((isset($_GET['myVariable'])) ? $_GET['myVariable'] : ""); ?>" />
<embed src="live_stream.swf?src=<?php echo((isset($_GET['myVariable'])) ? $_GET['myVariable'] : ""); ?>" ... >

in FLA/AS:
access variable thru:
this.loaderInfo.parameters["myVariable"]

No comments: