Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-17 Thread Ian Thomas
To expand on this (since I'm now awake!) what method I use depends on how I want to access the child objects. If I just want a list to iterate over/trawl through, I use an Array. If I want to access by name, I use an Object. The reasons I don't normally directly rely on the the childlist of the

Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-17 Thread Matt S.
Thanks, but what I'm more interested in was the statement that getChildByName is very slow, which others seemed to agree with. I guess I understood that as meaning that using gCBN can actually cause a performance hit. Is that the case? .m On 12/17/08, Ian Thomas i...@eirias.net wrote: To expand

[Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-16 Thread Mendelsohn, Michael
Wow, AS3 is different, even after reading Moock's book. I'm sure this is an easy question: How do you reference sprites within a sprite in an event listener? I have a child allcolumns within a sprite. Within allcolumns are 50 columns (sprites), each named column1, column2, etc. Allcolumns has

Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-16 Thread Taka Kojima
Hey Michael, seeing as you can't create Sprites on the timeline, the following won't work because your sprites don't have instance names. Thus when you are creating your sprites, you have to add them all to an array. i.e. var columns:Array = new Array(); for(var i:int = 0; i = 50; i ++){ var

Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-16 Thread Ian Thomas
If each of the columns has .name='column1' etc: e.target.getChildByName(column10).gotoAndStop(5); should do it. But personally I'd at least do some type-checking on all that, and would probably create a method inside an AllColumns class to handle changeChar(). (Obviously I don't know what

Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-16 Thread Anthony Pace
isn't getting a child by name very slow? Ian Thomas wrote: If each of the columns has .name='column1' etc: e.target.getChildByName(column10).gotoAndStop(5); should do it. But personally I'd at least do some type-checking on all that, and would probably create a method inside an AllColumns

Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-16 Thread Eric E. Dolecki
.currentTarget ? On Tue, Dec 16, 2008 at 4:51 PM, Ian Thomas i...@eirias.net wrote: Yes. However, it was the simplest answer to Michael's question. I'm afraid I didn't (and still don't) have time to answer the question with a long 'here's how I'd actually do it and why it's a good idea

Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-16 Thread Matt S.
So as a general question, what is the preferred method if you're trying to get, say, dynamically generated children, eg image1image20 etc, from a container? .m On Tue, Dec 16, 2008 at 4:51 PM, Ian Thomas i...@eirias.net wrote: Yes. On Tue, Dec 16, 2008 at 9:08 PM, Anthony Pace

Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-16 Thread Taka Kojima
I use the method I gave you earlier, adding elements to an array and accessing them that way. Also, you can use getChildAt() if you know the index of the children, which it sounds like you do if you have them named as you do... i.e. column1, column2, column3 On Tue, Dec 16, 2008 at 2:17 PM, Matt

Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-16 Thread Ian Thomas
On Tue, Dec 16, 2008 at 10:57 PM, Taka Kojima t...@gigafied.com wrote: I use the method I gave you earlier, adding elements to an array and accessing them that way. As do I. Ian ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com

Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-16 Thread Ian Thomas
Yes. However, it was the simplest answer to Michael's question. I'm afraid I didn't (and still don't) have time to answer the question with a long 'here's how I'd actually do it and why it's a good idea not to refer to nested clips like this' email, unfortunately. :-) It was a quick fix for

Re: [Flashcoders] referencing sprites within a sprite (AS3 newbie question)

2008-12-16 Thread Matt S.
I wasnt actually the original question-asker, but thanks :) I was just curious about the actual performance hit from getChild. .m On Tue, Dec 16, 2008 at 5:57 PM, Taka Kojima t...@gigafied.com wrote: I use the method I gave you earlier, adding elements to an array and accessing them that way.