Hi,

got a AS NooB Q.

I'm working on a project and have decided to finally jump ship to AS2,
but I've run into a (probably obvious) problem which has me a bit
stumped.

I've written a class, in which I have an array, but the array always
traces 'undefined' and I can't work out why.

right, so example code:

// ArrayTest.as

class ArrayTest {

        public var items_arr:Array;
        
        public function ArrayTest ()
        {
        }
        
        public function test (str:String)
        {
                this.items_arr.push (str);
                trace (this.items_arr);
        }
}

// Timeline

// import class
import ArrayTest.as;
// create instance
var Test:ArrayTest = new ArrayTest();
// add some values to the array
Test.test ('foo');
Test.test ('bar');

I'm pretty sure this is just me not grasping something bleedin' obvious!

tia,

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
_______________________________________________
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

Reply via email to