RE: [Flashcoders] referencing sprites within a sprite (AS3 newbiequestion)

2008-12-17 Thread Mendelsohn, Michael
Hi everyone...

Building an array using the references was the right answer.  I really
appreciate all of your replies.

Migrating from AS2 where I could easily reference via
this.that.these.those to DisplayObject references will take a bit of
getting used to I suppose.

Big thanks!
- Michael M.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] referencing sprites within a sprite (AS3 newbiequestion)

2008-12-16 Thread Mendelsohn, Michael
Thanks Ian.  That's the method I'm looking for, but can it work two
levels deep?  I'm really looking to change one MovieClip within each
of these columns.  Here's the code:

private function changeChar(e:Event):void {
var newFrame:uint = Math.random()*50;
var whichColumn:uint = Math.round(Math.random()*50);
var column:Sprite =
Sprite(e.target).getChildByName(String(column + whichColumn));
var ec:MovieClip = column.getChildByName(endChar);
ec.gotoAndStop(newFrame);
}


- MM



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 you're doing, though...)

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders