Search code examples
actionscript-3apache-flexflex4flash-builderflex3

Using array efficiently to disable buttons


For example i have values inside array.

Those values are the IDs of buttons. My question is how to use array efficiently to disable the buttons?


Solution

  • Say you have an array like in comments:

    var buttons:Array=new Array('button1','button2','button3');
    

    And you have button objects with names in your MC, namely button1, button2, button3. Use the following:

    for each (var s:String in buttons) this[s].disable();
    

    where "disable" is whatever you need to do to disable the button.