all groups > flash actionscript > june 2005 >
You're in the

flash actionscript

group:

Adding Button Component dynamically


Adding Button Component dynamically Dinghus
6/9/2005 11:05:22 PM
flash actionscript: I'm brain dumping on this. I am doing it like this:

for(x=0;x<=max;x++) {
var btnName = "button"+x;
var [btnName]mx.controls.Button;
}

It doesn't work.

Basically I am trying to make a menu of buttons dynamically. So I get the
list of topics from a database and then want to convert them to buttons that
when clicked open the appropriate page.
Re: Adding Button Component dynamically ...helmut
6/9/2005 11:13:08 PM
reference as

this[btnName].mx.contros.Button;

I hope that helps.

--
....helmut
helmutgranda.com



[quoted text, click to view]

Re: Adding Button Component dynamically mandingo
6/10/2005 12:00:00 AM
A lot of that would depend on what sort of data you got from the database...

creating a button with a text name of "This is how you replace all that
useless data with meaningful text" wouldn't necessarily be a good thing...

if your data was stored as object with attributes like "title","link" then it
may be better to create a custom button and extract from your database the
objects and define the button behaviours based on that.

cheers,
Re: Adding Button Component dynamically I flash therefore I am
6/10/2005 12:00:00 AM
I think most of the components are exportable for actionscript so you can
use attachMovie. The button component has the linkage ID of "Button".

AddThis Social Bookmark Button