<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Loading external .swf files in ActionScript 3.0</title>
	<atom:link href="http://www.heaveninteractive.com/weblog/2007/11/16/loading-external-swf-files-in-actionscript-30/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.heaveninteractive.com/weblog/2007/11/16/loading-external-swf-files-in-actionscript-30/</link>
	<description>Knowledge is Power.</description>
	<lastBuildDate>Mon, 07 Dec 2009 20:08:23 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jay</title>
		<link>http://www.heaveninteractive.com/weblog/2007/11/16/loading-external-swf-files-in-actionscript-30/comment-page-1/#comment-310</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Fri, 22 Feb 2008 13:08:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2007/11/16/loading-external-swf-files-in-actionscript-30/#comment-310</guid>
		<description>What I generally do in this case is to keep a variable in the child class, that is untyped. At runtime, you can then set this variable from the parent class.

So in the child swf&#039;s document class

class childSWF extends MovieClip {

  public var parentInstance:*;
  // other variables...

}

In the main (parent class), when you load the child, after you trigger your &#039;complete&#039; handler, you can then set the instance of the child.

Parent Class, after loading child...

this.loadedSwf.parentInstance = this;

You have now passed an instance of the parent class to the child .swf, including its document class.  This means your methods in the child can now access properties and methods of the main swf.  This is because the &#039;parentInstance&#039; variable in the child .swf&#039;s document class was untyped and can be set to any type of object, and the compiler won&#039;t complain.

Untyped variables are cool.</description>
		<content:encoded><![CDATA[<p>What I generally do in this case is to keep a variable in the child class, that is untyped. At runtime, you can then set this variable from the parent class.</p>
<p>So in the child swf&#8217;s document class</p>
<p>class childSWF extends MovieClip {</p>
<p>  public var parentInstance:*;<br />
  // other variables&#8230;</p>
<p>}</p>
<p>In the main (parent class), when you load the child, after you trigger your &#8216;complete&#8217; handler, you can then set the instance of the child.</p>
<p>Parent Class, after loading child&#8230;</p>
<p>this.loadedSwf.parentInstance = this;</p>
<p>You have now passed an instance of the parent class to the child .swf, including its document class.  This means your methods in the child can now access properties and methods of the main swf.  This is because the &#8216;parentInstance&#8217; variable in the child .swf&#8217;s document class was untyped and can be set to any type of object, and the compiler won&#8217;t complain.</p>
<p>Untyped variables are cool.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cksachdev</title>
		<link>http://www.heaveninteractive.com/weblog/2007/11/16/loading-external-swf-files-in-actionscript-30/comment-page-1/#comment-212</link>
		<dc:creator>cksachdev</dc:creator>
		<pubDate>Wed, 05 Dec 2007 12:34:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2007/11/16/loading-external-swf-files-in-actionscript-30/#comment-212</guid>
		<description>I wanted to have communication between child swf and parent swf such that child swf use object from the classes available in parent.
Any solution for this ...</description>
		<content:encoded><![CDATA[<p>I wanted to have communication between child swf and parent swf such that child swf use object from the classes available in parent.<br />
Any solution for this &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://www.heaveninteractive.com/weblog/2007/11/16/loading-external-swf-files-in-actionscript-30/comment-page-1/#comment-202</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Sat, 17 Nov 2007 05:43:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.heaveninteractive.com/weblog/2007/11/16/loading-external-swf-files-in-actionscript-30/#comment-202</guid>
		<description>Glad I could help you out!</description>
		<content:encoded><![CDATA[<p>Glad I could help you out!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.151 seconds -->
