PDA

View Full Version : Flash automatically creating an instance of class


Nessiah
09-04-2009, 10:52 AM
Morning all,

I am building a simple tamagotchi - alike application in AS2 and Flash is acting kind of weird on me. Lets say i have a .fla file with all my animations called Kitty.fla, then I have an external .as file called Kitty.as which contains a Kitty class with the Kitty(attribut i need to give it) function.

On the 1st frame on the timeline i have the following:

var kitty:Kitty = new Kitty('my attribute');

when compiling the movie, flash automatically creates an instance of Kitty but WITHOUT my attribute (its given a default value specified in the code) and then proceeds with the instance according to what i wrote above. So at the end i basically end up with two kitties, one with default attribute and second with the attribute specified by me, while I only need the one with the specified attrribute.

Anyone knows how to prevent flash from creating the first instance?

Help will be much appreciated, thanks