Re: [Flashcoders] eval gone in AS3, how to get reference to mc via target name?
While I agree that eval still had a use or two, you can easily write the function yourself and just add it to your code Library.. almost as good On Mar 4, 2006, at 5:40 PM, Boon Chew wrote: The problem is when you get an entire string (the target name), you just want to get to the reference in one shot (e.g. "mc1.mc2.mc3"). The collection method requires parsing before you can get to the reference. I was hoping Macromedia would provide at least a similar way to get to it when they retire eval in AS3. - boon --- ryanm <[EMAIL PROTECTED]> wrote: With the eval being gone in AS3, does anyone know how to get to the reference of a movieclip (via the target name string) without using eval? I know we can instantiate the class via the _global namespace but not positive about mc's. Using the object collection, like you should've been doing since eval was depreciated. parentclip["clipname"] Works for nested targets too: parentclip.subclip["clipname"] or parentclip["subclip"]["clipname"] Like this: trace(parentclip["subclip"]["clipname"]._x); or trace(_root["clip1"]["clip2"]["clip3"]["clip4"]._x) ryanm ___ 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 __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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] eval gone in AS3, how to get reference to mc via target name?
This is easy to emulate, first you split it in an array with .split("."), then you loop through the array and using getChildByName you can find your clip. Regards, Stan Vassilev - Original Message - From: "Boon Chew" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Sunday, March 05, 2006 12:40 AM Subject: Re: [Flashcoders] eval gone in AS3,how to get reference to mc via target name? The problem is when you get an entire string (the target name), you just want to get to the reference in one shot (e.g. "mc1.mc2.mc3"). The collection method requires parsing before you can get to the reference. I was hoping Macromedia would provide at least a similar way to get to it when they retire eval in AS3. ___ 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] eval gone in AS3, how to get reference to mc via target name?
The problem is when you get an entire string (the target name), you just want to get to the reference in one shot (e.g. "mc1.mc2.mc3"). The collection method requires parsing before you can get to the reference. I was hoping Macromedia would provide at least a similar way to get to it when they retire eval in AS3. Don't get the whole thing as a single string. Change your approach, rather than trying to find ways to make the language do something it's not intended to do. ryanm ___ 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] eval gone in AS3, how to get reference to mc via target name?
The problem is when you get an entire string (the target name), you just want to get to the reference in one shot (e.g. "mc1.mc2.mc3"). The collection method requires parsing before you can get to the reference. I was hoping Macromedia would provide at least a similar way to get to it when they retire eval in AS3. - boon --- ryanm <[EMAIL PROTECTED]> wrote: > > With the eval being gone in AS3, does anyone know > how to get to the > > reference of a movieclip (via the target name > string) without using eval? > > I know we can instantiate the class via the > _global namespace but not > > positive about mc's. > > > > Using the object collection, like you should've > been doing since eval > was depreciated. > > parentclip["clipname"] > > Works for nested targets too: > > parentclip.subclip["clipname"] > or > parentclip["subclip"]["clipname"] > > Like this: > > trace(parentclip["subclip"]["clipname"]._x); > or > trace(_root["clip1"]["clip2"]["clip3"]["clip4"]._x) > > ryanm > > ___ > 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 > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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] eval gone in AS3, how to get reference to mc via target name?
With the eval being gone in AS3, does anyone know how to get to the reference of a movieclip (via the target name string) without using eval? I know we can instantiate the class via the _global namespace but not positive about mc's. Using the object collection, like you should've been doing since eval was depreciated. parentclip["clipname"] Works for nested targets too: parentclip.subclip["clipname"] or parentclip["subclip"]["clipname"] Like this: trace(parentclip["subclip"]["clipname"]._x); or trace(_root["clip1"]["clip2"]["clip3"]["clip4"]._x) ryanm ___ 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] eval gone in AS3, how to get reference to mc via target name?
Boon Chew wrote: Will getChildByName work with a nested target name (e.g. "_level0.mc1.mc2.mc3")? No, it gets the child with the particular name in the display object container. You'll want to split the string apart: // Not tested - but you get the basic idea var parts:Array = name.split( '.' ); var reference:DisplayObject = root; for ( var i:int = 0; i < parts.length; i++ ) { reference = reference.getChildByName( parts[ i ] ); } // use reference here The above loop is equivalent to: reference = root.getChildByName( "mc1" ).getChildByName( "mc2" ).getChildByName( "mc3" ); -d ___ 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] eval gone in AS3, how to get reference to mc via target name?
Will getChildByName work with a nested target name (e.g. "_level0.mc1.mc2.mc3")? - boon "Darron J. Schall" <[EMAIL PROTECTED]> wrote: Boon Chew wrote: > With the eval being gone in AS3, does anyone know how to get to the reference > of a movieclip (via the target name string) without using eval? I know we > can instantiate the class via the _global namespace but not positive about > mc's. Use getChildByName( name): http://livedocs.macromedia.com/labs/1/flex/langref/flash/display/DisplayObjectContainer.html#getChildByName() Also, you should be using getClassByName( name ) to create a class based on it's name: http://livedocs.macromedia.com/labs/1/flex/langref/flash/util/package.html#getClassByName() -d ___ 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 - Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. - Yahoo! Mail Bring photos to life! New PhotoMail makes sharing a breeze. ___ 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] eval gone in AS3, how to get reference to mc via target name?
Boon Chew wrote: With the eval being gone in AS3, does anyone know how to get to the reference of a movieclip (via the target name string) without using eval? I know we can instantiate the class via the _global namespace but not positive about mc's. Use getChildByName( name): http://livedocs.macromedia.com/labs/1/flex/langref/flash/display/DisplayObjectContainer.html#getChildByName() Also, you should be using getClassByName( name ) to create a class based on it's name: http://livedocs.macromedia.com/labs/1/flex/langref/flash/util/package.html#getClassByName() -d ___ 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] eval gone in AS3, how to get reference to mc via target name?
Hi all, With the eval being gone in AS3, does anyone know how to get to the reference of a movieclip (via the target name string) without using eval? I know we can instantiate the class via the _global namespace but not positive about mc's. - boon - Yahoo! Mail Use Photomail to share photos without annoying attachments. ___ 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