<?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>Murtuza Topiwalla &#187; flashVars</title>
	<atom:link href="http://www.sowebme.com/murtaza/tag/flashvars/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sowebme.com/murtaza</link>
	<description>Blog about flash, movies, travel and more! Email me at yankeedoodles[at]hotmail[dot]com for anything you want to add!</description>
	<lastBuildDate>Wed, 13 Oct 2010 02:32:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Passing parameters from a holder to loaded swf</title>
		<link>http://www.sowebme.com/murtaza/2009/07/passing-parameters-from-a-holder-to-loaded-swf/</link>
		<comments>http://www.sowebme.com/murtaza/2009/07/passing-parameters-from-a-holder-to-loaded-swf/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 07:52:57 +0000</pubDate>
		<dc:creator>Murtuza</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flashVars]]></category>

		<guid isPermaLink="false">http://www.sowebme.com/murtaza/?p=21</guid>
		<description><![CDATA[Well there are many instances when we need to pass flashVars from the html to a preloader and then on to a loaded movieClip. This is how I&#8217;ve done it. HTML &#8211; &#60;param name=&#8221;FlashVars&#8221; value=&#8221;baseURL=http://www.sowebme.com/murtaza&#8221; /&#62; For AC_RunActiveContent.js users, There should be 3 instances where you would place this For swfObject users, there will be [...]]]></description>
			<content:encoded><![CDATA[<p>Well there are many instances when we need to pass flashVars from the html to a preloader and then on to a loaded movieClip.</p>
<p>This is how I&#8217;ve done it.</p>
<p>HTML &#8211;</p>
<p><span style="color: #ffcc99;">&lt;param name=&#8221;FlashVars&#8221; value=&#8221;baseURL=http://www.sowebme.com/murtaza&#8221; /&gt;</span><br />
For AC_RunActiveContent.js users, There should be 3 instances where you would place this<br />
For swfObject users, there will be only once.</p>
<p>Flash &#8211;<br />
holder mc will get the paramets from FlashVars in stage.loaderInfo.parameters.whatevernameditemhere</p>
<p>But a more robust way to ensure you have it and that you&#8217;ve not jumped the gun, use an event to ensure its ready.<br />
An example is as follows:</p>
<p><span style="color: #ffcc99;">root.loaderInfo.addEventListener(Event.COMPLETE, func);<br />
var parameters:Object=new Object();<br />
function func(e:Event):void {<br />
//Do what you want here<br />
}</span></p>
<p>Now to load another swf we will be using it to append to the current url we are already loading. So the above code will now look like</p>
<p><span style="color: #ffcc99;">root.loaderInfo.addEventListener(Event.COMPLETE, func);<br />
var parameters:Object=new Object();<br />
var loader:Loader=new Loader();<br />
function func(e:Event):void {<br />
loader.load(new URLRequest(&#8220;loadme.swf?baseURL=&#8221;+root.loaderInfo.parameters.baseURL));<br />
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);<br />
addChild(loader);<br />
}</span><br />
<span style="color: #ffcc99;">function swfLoaded(e:Event):void {<br />
//More code here<br />
}</span></p>
<p>So that about sums up how you can use flashVars and pass them along. Note one thing though. If you are using classes, you can use stage.loaderInfo instead of root.loaderInfo</p>
<p>You can download the source file for <a href="http://www.sowebme.com/murtaza/wp-content/uploads/2009/07/passingFlashVars.zip">passing flash vars</a></p>
<p>Have fun and please post your comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sowebme.com/murtaza/2009/07/passing-parameters-from-a-holder-to-loaded-swf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

