I am currently using a dictionary to associate a bullion for my (non-dynamic) sprites , But I want to know if there is a clever way of doing this? Movieclips are dynamic, but I will not use any movie clip properties or functions, so it comes under the best practice problem. I basically want to use MovieClips to allot my properties instead of just Sprites.
To create a state boolean property on my sprites - they are either locked or closed, so my Bullion variable is called IOn.
var mySprite: Sprite = new Sprite (); Var isOn: boolean = false; Verdict: dictionary = new dictionary (); Dict [mySprite] = ION;
Then I will vote my phantom to check my "ice" property. If it's on, I'll turn it off - or set it to the wrong.
if (dict [mySprite] == true] {dict [mySprite] = false; }
This is the first time that I am actually using dictionaries, so please correct me if I am using it wrong and, of course, my original question stands : Is this the best way to add a Boolean property to a non-dynamic object?
Can not you write your own phantom
Code> is property? This is a very easy way to get what you want, without using a MovieClip
.
isOn
A public server / setter If you want to make some argument on reading / writing it
Expands the spread of public squares {Private var _isOn: boolean; Public function is received (): Boolean {return _isOn; } Public function is set (v: boolean): zero {_isOn = v; }}
and then:
var mySprite: MySprite = new MySprite (); MySprite.isOn = false; // at some later point ... if (mySprite.isOn) {mySprite.isOn = false; }
Comments
Post a Comment