Thanks for the input James. I understand what you're saying but the fact that accessing inherited static variables works in another class but not on the timeline still gets me.
This solution was proposed to me and seems to work. In Orange.as add: private static var __proto__:Function = mypackage.Fruit; Now, Orange.COLOR outputs the proper value. Chris > Static variables are not inherited by subclasses in ECMAScript therefore > can not be referenced through derived class objects. This differs from > Java and C#. > > > James O'Reilly Consultant > Adobe Certified Flash Expert > http://www.jamesor.com > Design Code Train > > > > [EMAIL PROTECTED] wrote: >> Hi all. It's been a LONG time since I've posted and now I need your help >> again. >> >> I have come across something that to me doesn't seem correct and I don't >> know why things are behaving this way. I have 2 classes, one a subclass >> of >> the other. Both have public static variables (AS2.0 Flash 7). >> >> class mypackage.Fruit { >> public static var COLOR:Number = 0; >> } >> >> class mypackage.Orange extends mypackage.Fruit { >> public static var SEEDS:Number = 0; >> } >> >> Now in the Orange class or any other class that needs to use Orange. The >> following code: Orange.COLOR returns 0. >> >> import mypackage.Orange; >> class Table { >> public function Table() { >> trace("Orange.COLOR: " + Orange.COLOR); // outputs 0 >> } >> } >> >> Things change when this code is applied to the timeline: >> >> Table.fla >> import mypackage.Orange; >> trace("Orange.COLOR: " + Orange.COLOR); // outputs undefined >> trace("Orange.SEEDS: " + Orange.SEEDS); // outputs 0 >> >> Tracing Orange.COLOR gives me undefined. But if I import >> mypackage.Fruit. >> Fruit.COLOR traces out 0. >> >> Table.fla >> import mypackage.Fruit; >> trace("Fruit.COLOR: " + Fruit.COLOR); // outputs 0 >> >> Can someone shed some light on why in an FLA that the subclass (in this >> case Orange) cannot access its super class static variables >> (Orange.COLOR)? >> >> Thanks. >> \m/ >> _______________________________________________ >> [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 >> > _______________________________________________ > [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 > _______________________________________________ [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

