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 column:Sprite = new Sprite();
  allcolumns.addChild(column);
columns.push(column);
}

private function changeChar(e:Event):void {
       columns[9].gotoAndStop(5);

> }



On Tue, Dec 16, 2008 at 11:59 AM, Mendelsohn, Michael <
michael.mendels...@fmglobal.com> wrote:

> 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 an event listener:
>
> private function changeChar(e:Event):void {
>        e.target["column10"].gotoAndStop(5);
> }
>
>
> Result: ReferenceError: Error #1069: Property column10 not found on
> flash.display.Sprite and there is no default value.
>
> How to drill into what's in the e.target?
>
> Thanks,
> - Michael M.
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to