

































<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: How to Retrieve FlashVars Data in ActionScript 3.0</title>
	<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30</link>
	<description>Luck is the residue of good design.</description>
	<pubDate>Wed, 08 Feb 2012 15:20:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: Daksh</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-410795</link>
		<pubDate>Thu, 03 Sep 2009 15:38:35 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-410795</guid>
					<description>Hi David,

Great article. Was really helpfull. 

I have a Visual c++ application that can change variables in flash, but I have been trying to modify some of those variables in flash and read them back in visual studio. The problem ofcourse if that root.loaderInfo.parameters is read only. Do you have any idea how I can do this?

Thanks in advance!</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>Great article. Was really helpfull. </p>
<p>I have a Visual c++ application that can change variables in flash, but I have been trying to modify some of those variables in flash and read them back in visual studio. The problem ofcourse if that root.loaderInfo.parameters is read only. Do you have any idea how I can do this?</p>
<p>Thanks in advance!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-403542</link>
		<pubDate>Wed, 15 Jul 2009 13:19:00 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-403542</guid>
					<description>Matt,

Thanks for sharing your code!

I'm surprised the &lt;code&gt;scale&lt;/code&gt; param doesn't seem to work for you when you add it to the HTML.  Are you also setting the &lt;code&gt;salign&lt;/code&gt; param to &lt;code&gt;tl&lt;/code&gt; (top left)?  By happenstance, I recently tested &lt;code&gt;scale&lt;/code&gt; (in the HTML) with percentage-based width and heights, but I don't think I tested for pixel-based.  Interesting.

In any case, I'm glad to hear that the ActionScript approach is working for you!</description>
		<content:encoded><![CDATA[<p>Matt,</p>
<p>Thanks for sharing your code!</p>
<p>I&#8217;m surprised the <code>scale</code> param doesn&#8217;t seem to work for you when you add it to the HTML.  Are you also setting the <code>salign</code> param to <code>tl</code> (top left)?  By happenstance, I recently tested <code>scale</code> (in the HTML) with percentage-based width and heights, but I don&#8217;t think I tested for pixel-based.  Interesting.</p>
<p>In any case, I&#8217;m glad to hear that the ActionScript approach is working for you!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Matt</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-403339</link>
		<pubDate>Tue, 14 Jul 2009 03:10:59 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-403339</guid>
					<description>This was very helpful, thanks -- especially the discussion in the comments about the stage width and height. With that knowledge, and some trial and error, I was able to create a dynamic FLV player in ActionScript 3 that resizes nicely based on the width and height parameters of the OBJECT or EMBED tag. However, as you point out astutely, the actual pixel values do not get read into the Flash movie -- I got it working with a combination of keeping the aspect ratio and a bit of other code (shown below in case it's helpful to others):

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

var params:Object = LoaderInfo(this.root.loaderInfo).parameters;
player.source = params.file;  // 'file' is a flashvar that gets passed from the flashvars attribute of the object or embed tag
player.width = stage.stageWidth;
player.height = stage.stageHeight;

I noticed that I had to include the scaleMode and align settings in the ActionScript -- if I put them as attributes of the object/embed tag, it wouldn't work. (For example, 'scale=&quot;noscale&quot;' seemed not to change anything.) I'd be curious if anyone knew why that's the case.</description>
		<content:encoded><![CDATA[<p>This was very helpful, thanks &#8212; especially the discussion in the comments about the stage width and height. With that knowledge, and some trial and error, I was able to create a dynamic FLV player in ActionScript 3 that resizes nicely based on the width and height parameters of the OBJECT or EMBED tag. However, as you point out astutely, the actual pixel values do not get read into the Flash movie &#8212; I got it working with a combination of keeping the aspect ratio and a bit of other code (shown below in case it&#8217;s helpful to others):</p>
<p>stage.scaleMode = StageScaleMode.NO_SCALE;<br />
stage.align = StageAlign.TOP_LEFT;</p>
<p>var params:Object = LoaderInfo(this.root.loaderInfo).parameters;<br />
player.source = params.file;  // &#8216;file&#8217; is a flashvar that gets passed from the flashvars attribute of the object or embed tag<br />
player.width = stage.stageWidth;<br />
player.height = stage.stageHeight;</p>
<p>I noticed that I had to include the scaleMode and align settings in the ActionScript &#8212; if I put them as attributes of the object/embed tag, it wouldn&#8217;t work. (For example, &#8217;scale=&#8221;noscale&#8221;&#8216; seemed not to change anything.) I&#8217;d be curious if anyone knew why that&#8217;s the case.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-396531</link>
		<pubDate>Sun, 07 Jun 2009 14:22:12 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-396531</guid>
					<description>Eugene,

I haven't tried accessing &lt;code&gt;LoaderInfo.parameters&lt;/code&gt; from a C/C++ container, but according to the docs, the &lt;code&gt;parameters&lt;/code&gt; property is read-only, which doesn't surprise me.  The &lt;code&gt;Loader&lt;/code&gt; class deals with GET and POST data, so for your scenario, I think you'll be needing the &lt;code&gt;&lt;a href=&quot;http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/external/ExternalInterface.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;ExternalInterface&lt;/a&gt;&lt;/code&gt; class.</description>
		<content:encoded><![CDATA[<p>Eugene,</p>
<p>I haven&#8217;t tried accessing <code>LoaderInfo.parameters</code> from a C/C++ container, but according to the docs, the <code>parameters</code> property is read-only, which doesn&#8217;t surprise me.  The <code>Loader</code> class deals with GET and POST data, so for your scenario, I think you&#8217;ll be needing the <code><a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/external/ExternalInterface.html" target="_blank" rel="nofollow">ExternalInterface</a></code> class.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Eugene</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-396451</link>
		<pubDate>Sun, 07 Jun 2009 08:14:54 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-396451</guid>
					<description>Thank you for a great post! It helped me a lot. Now I have another challenge. Is it possible to have the swf file modify  root.loaderInfo.parameters. and let the server know the new content? Was your reply to Ricky addressing this issue? If so, could you please elaborate on how the Loader class is used in AS3?

I am using VC++ which plays an SWF file. In the C++ code, .put_FlashVars works (flash receives the variable in root.loaderInfo.parameters. but .get_FlashVars() returns null. Now I am clueless.

Thank you again.</description>
		<content:encoded><![CDATA[<p>Thank you for a great post! It helped me a lot. Now I have another challenge. Is it possible to have the swf file modify  root.loaderInfo.parameters. and let the server know the new content? Was your reply to Ricky addressing this issue? If so, could you please elaborate on how the Loader class is used in AS3?</p>
<p>I am using VC++ which plays an SWF file. In the C++ code, .put_FlashVars works (flash receives the variable in root.loaderInfo.parameters. but .get_FlashVars() returns null. Now I am clueless.</p>
<p>Thank you again.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-377368</link>
		<pubDate>Fri, 03 Apr 2009 19:40:59 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-377368</guid>
					<description>&lt;strong&gt;To Jasmin:&lt;/strong&gt;

Thanks for that alternate approach!  The query string approach you mentioned works in older versions of Flash Player, in addition to current versions, while FlashVars requires Flash Player 6 or higher &amp;#8212; so like you, I'm surprised your project seems to only work with the query string approach.  In any case, I'm glad you found that ... and again, thanks for sharing the info!  :)

&lt;strong&gt;To Ricky:&lt;/strong&gt;

To send variables out, you'll want the &lt;code&gt;LoadVars&lt;/code&gt; class in AS2 and the &lt;code&gt;Loader&lt;/code&gt; class in AS3.</description>
		<content:encoded><![CDATA[<p><strong>To Jasmin:</strong></p>
<p>Thanks for that alternate approach!  The query string approach you mentioned works in older versions of Flash Player, in addition to current versions, while FlashVars requires Flash Player 6 or higher &mdash; so like you, I&#8217;m surprised your project seems to only work with the query string approach.  In any case, I&#8217;m glad you found that &#8230; and again, thanks for sharing the info!  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>To Ricky:</strong></p>
<p>To send variables out, you&#8217;ll want the <code>LoadVars</code> class in AS2 and the <code>Loader</code> class in AS3.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Ricky</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-377361</link>
		<pubDate>Fri, 03 Apr 2009 19:24:00 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-377361</guid>
					<description>How do you sent varibles like input text, .jpg to an asp handler</description>
		<content:encoded><![CDATA[<p>How do you sent varibles like input text, .jpg to an asp handler
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Jasmin Auger</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-234814</link>
		<pubDate>Thu, 31 Jul 2008 17:27:07 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-234814</guid>
					<description>Hi David, sorry to bring an old post back to life, but I just wanted to tell you that the only way I have been able to pass an external variable to my SWF was to put them after the name of the swf in the js variable, and in the param and the embed tags. I've been searching over the internet for about 2 hours now and it seems it's the only thing that works for me. I have a rather complex project, but I don't understand why it doesn't work using the FlashVars method... When using FlashVars, the variables are simply not passed and I get a &quot;url parameter must be non-null&quot; error.

Here are the 3 var I had to change:

In the AC_FL_RunContent script:

'movie', 'gallery?menuName=xml/MenuAng.xml&amp;#38;pictureName=xml/Pictures.xml',

In the param tag:



and in the embed tag:

src=&quot;gallery.swf?menuName=xml/MenuAng.xml&amp;#38;pictureName=xml/Pictures.xml&quot;

Hope this might help other people!</description>
		<content:encoded><![CDATA[<p>Hi David, sorry to bring an old post back to life, but I just wanted to tell you that the only way I have been able to pass an external variable to my SWF was to put them after the name of the swf in the js variable, and in the param and the embed tags. I&#8217;ve been searching over the internet for about 2 hours now and it seems it&#8217;s the only thing that works for me. I have a rather complex project, but I don&#8217;t understand why it doesn&#8217;t work using the FlashVars method&#8230; When using FlashVars, the variables are simply not passed and I get a &#8220;url parameter must be non-null&#8221; error.</p>
<p>Here are the 3 var I had to change:</p>
<p>In the AC_FL_RunContent script:</p>
<p>&#8216;movie&#8217;, &#8216;gallery?menuName=xml/MenuAng.xml&amp;pictureName=xml/Pictures.xml&#8217;,</p>
<p>In the param tag:</p>
<p>and in the embed tag:</p>
<p>src=&#8221;gallery.swf?menuName=xml/MenuAng.xml&amp;pictureName=xml/Pictures.xml&#8221;</p>
<p>Hope this might help other people!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-136071</link>
		<pubDate>Mon, 18 Feb 2008 19:23:58 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-136071</guid>
					<description>J,

Haha, you're welcome!  Glad I could help.  :)</description>
		<content:encoded><![CDATA[<p>J,</p>
<p>Haha, you&#8217;re welcome!  Glad I could help.  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: J</title>
		<link>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-136064</link>
		<pubDate>Mon, 18 Feb 2008 19:09:27 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30#comment-136064</guid>
					<description>THANK YOU THANK YOU THANK YOU THANK YOU!!!!!!!!!!!!!!!!!!!!!!!</description>
		<content:encoded><![CDATA[<p>THANK YOU THANK YOU THANK YOU THANK YOU!!!!!!!!!!!!!!!!!!!!!!!
</p>
]]></content:encoded>
				</item>
</channel>
</rss>

