<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>bunnyhero dev &#187; quirks</title>
	<atom:link href="http://www.bunnyhero.org/tag/quirks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bunnyhero.org</link>
	<description>Notes on iPhone, Flash and Web development</description>
	<lastBuildDate>Tue, 31 Aug 2010 20:51:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Weird query string variable behaviour (ActionScript 2)</title>
		<link>http://www.bunnyhero.org/2008/05/02/weird-query-string-variable-behaviour/</link>
		<comments>http://www.bunnyhero.org/2008/05/02/weird-query-string-variable-behaviour/#comments</comments>
		<pubDate>Fri, 02 May 2008 05:45:50 +0000</pubDate>
		<dc:creator>bunnyhero</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript 2]]></category>
		<category><![CDATA[Flash Player 8]]></category>
		<category><![CDATA[quirks]]></category>

		<guid isPermaLink="false">http://www.bunnyhero.org/?p=69</guid>
		<description><![CDATA[I just discovered some strange behaviour in the Flash player if you try to change variables passed in through the query string before the movie has finished loading. That is: If a movie is loaded with the URL: movie.swf?a=initialValue and the movie contains a script that does something like this: _level0.a = "some other value" the value of a will get reset to &#8220;initialValue&#8221; on every frame, until the movie finishes loading! This is different than if you pass in the variable using flashVars. If you use flashVars, the variable stays set, as you would expect it to. Here are some tests to demonstrate the behaviour. It&#8217;s best to clear your cache in between each test, or you will get varying results. Using query string variables Using flashVars Here&#8217;s a screenshot from a test using query string variables: The test movie is embedded with code that passes the variable &#8220;a&#8221; set to &#8220;from html&#8220;. The movie continually displays the value of the variable &#8220;a&#8221; in the scrolling text field. On the fourth frame, it changes the the value of a to &#8220;set from script.&#8221; At any time, you can click on the &#8220;Set&#8221; button to set the variable to &#8220;set [...]]]></description>
			<content:encoded><![CDATA[<p>I just discovered some strange behaviour in the Flash player if you try to change variables passed in through the query string before the movie has finished loading.</p>
<p>That is:<br />
If a movie is loaded with the URL:<br />
<code style="background: #ddf">movie.swf?a=initialValue</code></p>
<p>and the movie contains a script that does something like this:<br />
<code style="background: #ddf">_level0.a = "some other value"</code></p>
<p>the value of <code>a</code> will get <em><strong>reset to &#8220;<code>initialValue</code>&#8221; on every frame</strong></em>, until the movie finishes loading!</p>
<p>This is different than if you pass in the variable using <code>flashVars</code>. If you use <code>flashVars</code>, the variable stays set, as you would expect it to.</p>
<p>Here are some tests to demonstrate the behaviour. It&#8217;s best to clear your cache in between each test, or you will get varying results.</p>
<ul>
<li><a href="http://www.bunnyhero.org/static/querystringvars/testquerystring.html">Using query string variables</a>
</li>
<li><a href="http://www.bunnyhero.org/static/querystringvars/testflashvars.html">Using flashVars</a>
</li>
</ul>
<p>Here&#8217;s a screenshot from a test using query string variables:<br />
<img src="http://www.bunnyhero.org/wp-content/uploads/2008/05/2008-05-02_0106.jpg" alt="screenshot from test movie" title="query string screenshot" width="410" height="300" class="alignnone size-full wp-image-71" /><br />
The test movie is embedded with code that passes the variable &#8220;<code>a</code>&#8221; set to &#8220;<code>from html</code>&#8220;. The movie continually displays the value of the variable &#8220;<code>a</code>&#8221; in the scrolling text field. On the fourth frame, it changes the the value of <code>a</code> to &#8220;<code>set from script</code>.&#8221;</p>
<p>At any time, you can click on the &#8220;Set&#8221; button to set the variable to &#8220;set from script.&#8221; When the movie is finished loading (there&#8217;s a 700K JPEG file on the last frame to make the movie large and slow-loading), you can click the &#8220;Stop&#8221; button to stop the scrolling text field from updating.</p>
<p>Play with both tests, and compare the effects if you clear the cache between tests or not, and try clicking &#8220;Set&#8221; at different times.</p>
<p><strong>UPDATE: </strong>This only seems to occur in movies published for Flash Player 8! Here&#8217;s a test using a movie published for Player 7 and variables passed via the query string:</p>
<ul>
<li><a href="http://www.bunnyhero.org/static/querystringvars/testquerystring7.html">Using query string variables, Flash Player 7</a></li>
</ul>
<p>And, of course, I have no idea how ActionScript 3/Flash Player 9 behaves in a similar situation&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bunnyhero.org/2008/05/02/weird-query-string-variable-behaviour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
