PDA

View Full Version : dynamically position button with action inside


tobycraftse
07-23-2008, 11:11 PM
I have 100 button icon, when flash program runs, how to dynamically choose button i want and put it on canvas using action script?

for example, when user choose computer - all icon button related to computer will get put on canvas ... etc

each button will have action script attach to it and do something.

any examples?

pierre23
07-23-2008, 11:44 PM
you have 100 different buttons you intend to put different actions on ^_-? Thats an extremely long way of giving actions to buttons, especially if you have to change any in the future.. I suggest you give your buttons functions through actionscript all on one layer.. this way its much much quicker and easier to get to for later reference

An easy way of doing what you want to do Id imagine is, If you have different groups, say, for example, an icon of a computer - and all the icons related to the computer are in a movieclip, and all icons related to another button are in another movieclip and so on. All the grouped icons are set to _visible = false; and when the user clicks the computer icon, you'd set _visible = true; to the computer group etc