PDA

View Full Version : FlashVars Won't Pass in AS2


MysticalMatt517
03-27-2010, 06:37 AM
I'm trying to pass a FlashVar that will populate a dynamic text field.

I have created a dynamic text box and named the instance "textbox".

In the first frame I've added the following line of actionscript:
textbox.text = var1;

I've added the following to my HTML file:

<param name=FlashVars value="var1=testing">

<embed src="test.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="test" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="var1=testing" />

When I load the HTML file the movie displays "undefined" which tells me that somehow that variable isn't making it from the HTML file into the swf.

What am I doing wrong?

Sicontis
03-28-2010, 02:58 AM
There is block of Javascript in the HTML that Flash publishes that you can add the Flashvars to.


<script language="JavaScript" type="text/javascript">
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
'width', '550',
'height', '400',
'src', 'PostVariables',
'quality', 'high',
'pluginspage', 'http://www.adobe.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'PostVariables',
'bgcolor', '#ffffff',
'name', 'PostVariables',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'PostVariables',
'salign', '',
'FlashVars', 'var1=testing'
); //end AC code
</script>

MysticalMatt517
03-28-2010, 05:24 AM
That did it! Thank you!!!