There's no need to use "this" when referring to class variables from
within the class itself.

class ArrayTest {
        public var myArray:Array;
        
        public function ArrayTest() {
                myArray = [];
        }
        public function test(str:String):Void {
                myArray.push(str);
                trace(myArray);
        }
}

BLITZ | Steven Sacks - 310-551-0200 x209

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Jon Bennett
> Sent: Tuesday, October 10, 2006 12:44 PM
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] Moving to AS2, array always undefined
> 
> > Or you can do it in the class' constructor:
> >
> > class ArrayTest {
> >    public var aryItems:Array;
> >    public function ArrayTest ()
> >    {
> >      this.aryItems = new Array();
> >    }
> >    public function test (str:String):Void
> >    {
> >      this.aryItems.push (str);
> >      trace (this.aryItems);
> >    }
> > }

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