Couldn't you just set a variable and pass that to whichever class/method
needs to access the child by name?


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Patrick
Matte|BLITZ
Sent: Thursday, June 07, 2007 1:40 PM
To: [email protected]
Subject: RE: [Flashcoders] as3 Loader.content.name error

I want to rename the content because I need to be able to access it later
using getChildByName("test");

But since its not possible, I think I'll have to make my classes dynamic and
do this instead :

private function loaderInit(event:Event):void{
        event.target.removeEventListener(Event.INIT, loaderInit);
        this["test"] = event.target.content;
        addChild( this["test"] );
}



BLITZ | Patrick Matte - 310-551-0200 x214

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rob Romanek
Sent: Thursday, June 07, 2007 7:19 AM
To: [email protected]
Subject: Re: [Flashcoders] as3 Loader.content.name error

If you want to call addChild on the content then you can simply do:

addChild(event.target.content)

and that will throw your content on the stage. I'm not sure why it is not
possible to name that new content. I've tried playing around with this
myself and can't figure out how once you've loaded the content you can
access that content as a class. I've loaded up swfs and can reference
classes within the swf no problem and create instances of those classes
but if I try to get a class definition for the content all I can get is
MovieClip and I can't figure out how to create new instances of the that
loaded content without running another loader

Not sure if that helps you any or not.

Rob

On Wed, 06 Jun 2007 22:59:33 -0400, Patrick Matte|BLITZ
<[EMAIL PROTECTED]> wrote:

> Is there a way a change the name of the Loader content property. I'd
> like to call addChild() on the content instead of the Loader itself.
> Like this :
>
>
> loader = new Loader();
> loader.contentLoaderInfo.addEventListener(Event.INIT, loaderInit);
> var request:URLRequest = new URLRequest(pageSource);
> loader.load(request);
>
> private function loaderInit(event:Event):void{
>         event.target.removeEventListener(Event.INIT, loaderInit);
>         var page:Page = event.target.content;
>         page.name = "test";
> }
>
>
> That code throws this error but I cant understand why.
>
> Error: Error #2078: The name property of a Timeline-placed object cannot
> be modified.
>         at flash.display::DisplayObject/set name()
>         at com.blitzagency.fabric::Main/::loaderInit()
>
_______________________________________________
[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
_______________________________________________
[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

_______________________________________________
[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