Search code examples
actionscript-3variablesactionscriptmovieclip

Actionscript 3: apply property to all vars or MovieClips


I want to know if it's possible, and if so how, to apply a property of a var to multiple vars at once. I'm making a point-n-click game where i want to apply the buttonMode property to multiple variables (of MovieClips).

I don't know if this is even possible or how simple or advanced this is, but it would be damn handy.

I have searched on Google and this site for a possible answer, with different search terms/keywords, but can't find anything close. I also tried different things with an asterisk such as *.buttonMode = true and movieClip.*.buttonMode = true but no success.

Any help would be very much appreciated.


Solution

  • All you really need to do is bind a specific property of all these movieclips to a bindable variable.

    For more information on bindable variables visit :
    1. http://www.flexafterdark.com/docs/ActionScript-Bindable
    2. http://jacwright.com/blog/54/actionscript-3-bindable-dynamic-objects/

    Bindables come in handy whenver you want many objects to refer to a property , and on the change of this property, some property in the object(s) which have binded to this bindable variable will change.