Re: [Flashcoders] AS3 root

2007-06-19 Thread John Grden

Test the parent to see if it equals the stage maybe?

if(this.parent == this.stage)

stage is only available after adding the DisplayObject to the display list
etc

On 6/19/07, Patrick Matte|BLITZ [EMAIL PROTECTED] wrote:


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?
___
Flashcoders@chattyfig.figleaf.com
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





--
[  JPG  ]
___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] AS3 root

2007-06-19 Thread Derek Vadneau
This one works for me.

if (loaderInfo.url == loaderInfo.loaderURL)
{
// This is the main SWF.
}


Derek Vadneau

- Original Message - 
From: Patrick Matte|BLITZ
To: flashcoders@chattyfig.figleaf.com
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?


___
Flashcoders@chattyfig.figleaf.com
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


RE: [Flashcoders] AS3 root

2007-06-19 Thread Palmer, Jim

Check out the MovieClip._lockroot parameter

livedocs.adobe.com/flash/mx2004/main_7_2/1522.html

--
Jim Palmer ! Mammoth Web Operations

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of John
 Grden
 Sent: Tuesday, June 19, 2007 12:56 PM
 To: flashcoders@chattyfig.figleaf.com
 Subject: Re: [Flashcoders] AS3 root
 
 
 Test the parent to see if it equals the stage maybe?
 
 if(this.parent == this.stage)
 
 stage is only available after adding the DisplayObject to the 
 display list
 etc
 
 On 6/19/07, Patrick Matte|BLITZ [EMAIL PROTECTED] wrote:
 
  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?
  ___
  Flashcoders@chattyfig.figleaf.com
  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
 
 
 
 
 -- 
 [  JPG  ]
 ___
 Flashcoders@chattyfig.figleaf.com
 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
 
___
Flashcoders@chattyfig.figleaf.com
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


RE: [Flashcoders] AS3 root

2007-06-19 Thread David Ngo
Does _lockroot still apply to AS3?



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Palmer, Jim
Sent: Tuesday, June 19, 2007 4:14 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] AS3 root


Check out the MovieClip._lockroot parameter

livedocs.adobe.com/flash/mx2004/main_7_2/1522.html

--
Jim Palmer ! Mammoth Web Operations

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of John
 Grden
 Sent: Tuesday, June 19, 2007 12:56 PM
 To: flashcoders@chattyfig.figleaf.com
 Subject: Re: [Flashcoders] AS3 root
 
 
 Test the parent to see if it equals the stage maybe?
 
 if(this.parent == this.stage)
 
 stage is only available after adding the DisplayObject to the 
 display list
 etc
 
 On 6/19/07, Patrick Matte|BLITZ [EMAIL PROTECTED] wrote:
 
  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?
  ___
  Flashcoders@chattyfig.figleaf.com
  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
 
 
 
 
 -- 
 [  JPG  ]
 ___
 Flashcoders@chattyfig.figleaf.com
 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
 
___
Flashcoders@chattyfig.figleaf.com
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

___
Flashcoders@chattyfig.figleaf.com
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


Re: [Flashcoders] AS3 root

2007-06-19 Thread Muzak
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: flashcoders@chattyfig.figleaf.com
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: flashcoders@chattyfig.figleaf.com
 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?




___
Flashcoders@chattyfig.figleaf.com
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