Another way would be to check if there's a parentDomain (using loaderInfo).
It's a bit more complicated though (well, just more code)..

import flash.system.ApplicationDomain;
import flash.display.LoaderInfo;
import flash.events.Event;

function initHandler(e:Event):void {
 trace("Application ::: initHandler");
 trace((e.currentTarget as LoaderInfo).applicationDomain.parentDomain);
}
this.loaderInfo.addEventListener(flash.events.Event.INIT, initHandler);


When not loaded into another swf will return null, otherwise returns an 
ApplicationDomain instance

regards,
Muzak

----- Original Message ----- 
From: "Derek Vadneau" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, June 19, 2007 10:03 PM
Subject: Re: [Flashcoders] AS3 root


> This one works for me.
>
> if (loaderInfo.url == loaderInfo.loaderURL)
> {
> // This is the main SWF.
> }
>
>
> Derek Vadneau
>
> ----- Original Message ----- 
> From: Patrick Matte|BLITZ
> To: [email protected]
> Sent: Tuesday, June 19, 2007 3:48 PM
> Subject: SPAM-LOW: [Flashcoders] AS3 root
>
>
> Hi fellas, I have a swf that's loaded inside another one. The container
> swf calls the transitionIn function in the loaded swf. In AS2, I used to
> put this in the loaded swf:
>
> if(this == _root){
>        transitionIn();
> }
>
> That way I could test my swf in the flash IDE independently from the
> parent swf. If the swf was loaded in the container, this wouldn't be eqal
> to _root and the transitionIn would not be called.
>
> I'm trying to do the same thing in AS3. Every displayObject container has
> a root property but, it stops at the swf level. So root of the loaded swf
> is equal to the actual swf, not the container. So how can I know if the
> swf is tested by itself in the IDE or it is loaded by the container?
>
>


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to