

































<?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: Is _root Evil?</title>
	<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil</link>
	<description>Luck is the residue of good design.</description>
	<pubDate>Tue, 07 Feb 2012 19:41:26 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-78938</link>
		<pubDate>Wed, 05 Sep 2007 21:53:25 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-78938</guid>
					<description>sydney,

Glad to hear it!  :)  Although I'm happy this blog entry clarified matters for you, I can't stress enough (not just to you, but anyone) that you shouldn't rely on &lt;code&gt;_root&lt;/code&gt; as a crutch.  Understand it, use it when appropriate or convenient, but be aware of its limitations.</description>
		<content:encoded><![CDATA[<p>sydney,</p>
<p>Glad to hear it!  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Although I&#8217;m happy this blog entry clarified matters for you, I can&#8217;t stress enough (not just to you, but anyone) that you shouldn&#8217;t rely on <code>_root</code> as a crutch.  Understand it, use it when appropriate or convenient, but be aware of its limitations.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: sydney</title>
		<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-78897</link>
		<pubDate>Wed, 05 Sep 2007 20:12:03 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-78897</guid>
					<description>Hey, I just wanted to say thank you. 
this bit:
      this._parent._parent._parent.function();
       … which can be difficult to scan visually.  Now, using _root in the following 
        context provides a shortcut to the main timeline …
        _root.function();
cleared up about 2 weeks of class that I didn't understand! your writting is fantastic. 
Thank You!!!!</description>
		<content:encoded><![CDATA[<p>Hey, I just wanted to say thank you.<br />
this bit:<br />
      this._parent._parent._parent.function();<br />
       … which can be difficult to scan visually.  Now, using _root in the following<br />
        context provides a shortcut to the main timeline …<br />
        _root.function();<br />
cleared up about 2 weeks of class that I didn&#8217;t understand! your writting is fantastic.<br />
Thank You!!!!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-75924</link>
		<pubDate>Mon, 27 Aug 2007 00:40:19 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-75924</guid>
					<description>Claudiu,

It may help you to understand that timeline layers are merely a convenience during authoring.  In the published SWF, timeline layers are translated into a complex series of depths that correspond to layers, but aren't actually the same thing.

Your ActionScript, as shown, leaves me a bit confused.  I'm not sure what your three lines mean (I don't see any lines that load an external SWF).  What approach have you used to load your content &amp;#8212; &lt;code&gt;MovieClipLoader&lt;/code&gt;, for example?  If so, you will have specified a target (a movie clip container) into which your external SWF should load.  That target will be the path you need.</description>
		<content:encoded><![CDATA[<p>Claudiu,</p>
<p>It may help you to understand that timeline layers are merely a convenience during authoring.  In the published SWF, timeline layers are translated into a complex series of depths that correspond to layers, but aren&#8217;t actually the same thing.</p>
<p>Your ActionScript, as shown, leaves me a bit confused.  I&#8217;m not sure what your three lines mean (I don&#8217;t see any lines that load an external SWF).  What approach have you used to load your content &mdash; <code>MovieClipLoader</code>, for example?  If so, you will have specified a target (a movie clip container) into which your external SWF should load.  That target will be the path you need.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Claudiu</title>
		<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-75803</link>
		<pubDate>Sun, 26 Aug 2007 12:34:07 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-75803</guid>
					<description>I have main moviclip.Inside this movieclip I have 2 layers. On the 1st keyframe of layer1 I have _root to moviclip to load
[ _root.section != &quot;a.swf&quot;; {
_root.section = &quot;a.swf&quot;;
_root.transition.gotoAndPlay(&quot;closing&quot;); ]

thing is this is not leading me to the a.swf. I need to know the road to that a.swf.


P.S. If I have the 2 layers on scene1 the path, shown above, works</description>
		<content:encoded><![CDATA[<p>I have main moviclip.Inside this movieclip I have 2 layers. On the 1st keyframe of layer1 I have _root to moviclip to load<br />
[ _root.section != &#8220;a.swf&#8221;; {<br />
_root.section = &#8220;a.swf&#8221;;<br />
_root.transition.gotoAndPlay(&#8221;closing&#8221;); ]</p>
<p>thing is this is not leading me to the a.swf. I need to know the road to that a.swf.</p>
<p>P.S. If I have the 2 layers on scene1 the path, shown above, works
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-67341</link>
		<pubDate>Thu, 26 Jul 2007 20:35:01 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-67341</guid>
					<description>mindaugas,

Rockin'!  :)</description>
		<content:encoded><![CDATA[<p>mindaugas,</p>
<p>Rockin&#8217;!  <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: mindaugas</title>
		<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-66655</link>
		<pubDate>Mon, 23 Jul 2007 14:33:32 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-66655</guid>
					<description>this._lockroot = true; 
on first frame of external swf, for me it's working:)</description>
		<content:encoded><![CDATA[<p>this._lockroot = true;<br />
on first frame of external swf, for me it&#8217;s working:)
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-62847</link>
		<pubDate>Tue, 10 Jul 2007 20:17:38 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-62847</guid>
					<description>Dario,

Flash often allows dozens of solving the same problem.  Your approach may just do it.  You could also use ...

&lt;code&gt;if (this._parent._parent._parent) { ... }&lt;/code&gt;

... nested as often as makes sense.</description>
		<content:encoded><![CDATA[<p>Dario,</p>
<p>Flash often allows dozens of solving the same problem.  Your approach may just do it.  You could also use &#8230;</p>
<p><code>if (this._parent._parent._parent) { ... }</code></p>
<p>&#8230; nested as often as makes sense.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Dario</title>
		<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-61835</link>
		<pubDate>Fri, 06 Jul 2007 15:48:18 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-61835</guid>
					<description>(Maybe) I've found a way...
I set a variable in the main timeline of my loaded SWF:
&lt;code&gt;
effroot = 1;
&lt;/code&gt;
...and then I write this (everywhere) when I want to test where that SWF is:
&lt;code&gt;
if (_root.effroot == 1) {
	trace(&quot;stand alone&quot;);
} else {
	trace(&quot;inside&quot;);	
}
&lt;/code&gt;
It should work.</description>
		<content:encoded><![CDATA[<p>(Maybe) I&#8217;ve found a way&#8230;<br />
I set a variable in the main timeline of my loaded SWF:<br />
<code><br />
effroot = 1;<br />
</code><br />
&#8230;and then I write this (everywhere) when I want to test where that SWF is:<br />
<code><br />
if (_root.effroot == 1) {<br />
	trace("stand alone");<br />
} else {<br />
	trace("inside");<br />
}<br />
</code><br />
It should work.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Dario</title>
		<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-61638</link>
		<pubDate>Thu, 05 Jul 2007 16:57:28 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-61638</guid>
					<description>Hey, that's a help! Thank you!! ;)
My script is inside a clip, inside another clip, inside one more clip, maybe inside.....
Can you suggest me a line of code to find out (from this deep clip) if my &quot;stan-alone-root&quot; is (or not) the &quot;real-root&quot;?
(I'm not really an AS ace!)</description>
		<content:encoded><![CDATA[<p>Hey, that&#8217;s a help! Thank you!! <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
My script is inside a clip, inside another clip, inside one more clip, maybe inside&#8230;..<br />
Can you suggest me a line of code to find out (from this deep clip) if my &#8220;stan-alone-root&#8221; is (or not) the &#8220;real-root&#8221;?<br />
(I&#8217;m not really an AS ace!)
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-61626</link>
		<pubDate>Thu, 05 Jul 2007 15:02:40 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/actionscript-20/is-root-evil#comment-61626</guid>
					<description>Dario,

You shouldn't have to rewrite anything, actually.  I'm not sure what your references to &lt;code&gt;_level0&lt;/code&gt; are used for in the external files, but as discussed in the article, those references change depending on whether the files stand alone or are loaded into another SWF.  If the ActionScript in your external files &lt;em&gt;must&lt;/em&gt; reference &lt;code&gt;_root&lt;/code&gt; or &lt;code&gt;_level0&lt;/code&gt;, you could set up an &lt;code&gt;if&lt;/code&gt; statement that checks to see if the current file (the external file) has a parent.  If it does, that means it's been loaded, and you can make your references one way.  If it doesn't, that means it stands alone, and you can use other paths.

e.g.
&lt;code&gt;if (this._parent) { ... }&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Dario,</p>
<p>You shouldn&#8217;t have to rewrite anything, actually.  I&#8217;m not sure what your references to <code>_level0</code> are used for in the external files, but as discussed in the article, those references change depending on whether the files stand alone or are loaded into another SWF.  If the ActionScript in your external files <em>must</em> reference <code>_root</code> or <code>_level0</code>, you could set up an <code>if</code> statement that checks to see if the current file (the external file) has a parent.  If it does, that means it&#8217;s been loaded, and you can make your references one way.  If it doesn&#8217;t, that means it stands alone, and you can use other paths.</p>
<p>e.g.<br />
<code>if (this._parent) { ... }</code>
</p>
]]></content:encoded>
				</item>
</channel>
</rss>

