简体   繁体   中英

Flex Buttons from string

I have buttons with id's button1, button2, button3, etc.

I have a for loop that i need to loop starting with a number and i need to enable buttons based on my loop. I need help taking my string button1 and making that the id "button1" so i can use the button property's.

Any help would be greatly appreciated.

Thanks!

You should be able to iterate as such:

for (var i:uint = 1; i <= 3; i++)
{
    var element:IVisualElement = this["group" + i];
}

You don't denote whether this Spark or Halo, but clearly substitute IVisualElement with the type of your choice. (Button, UIComponent, DisplayObject...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM