This content has been marked as final. Show 2 replies
Typically, you would make a manager class that contains references to your
button class. That way the manager can easily iterate over all instances of
the button and do whatever it likes. You could do it as simple as - within
the constructor of each button you can call a 'addInstance' method within
the manager, where the manager would then add each instance to an instance
array. Then, when a button is clicked send that button's instance to the
manager - (btnClick method or something) and dim all but the instance being
Adobe Community Expert
Ok, thank you for the anwer!
So there is no way of a class to know how many instances that are vreated from it without saving references in an array?
Couldn't I then use a static property to keep track of each button reference (in this case)? And have a method that itterates through the array?
I dont really understand what you mean with manager class. Is that proper lingo? (so I can look it up).
Do you mean that i should have a superclass?
My real scenario is that I have a class linked to a couple of buttons. The class has onRollOver, onRollOut and onPress methods. Then I want to have an onDim method that is called when a button is clicked. I want this onDim function to be called on each button. (The clikced and the other ones). The reaseon is that I want to deactivate all buttons (MovieClips with button handlers) with:
This because of a pop-up appears over all the buttons.