Highlighted

Create Buttons dynamically

Avatar

Avatar

Merlyn_MM

Avatar

Merlyn_MM

Merlyn_MM

15-09-2008

Hi



I am pretty new to Flex and I am trying to populate buttons
dynamically that are in different colors and different label name
etc... I have cfc that returns an xml document with all the details
but how can I bind the data and layout the buttons on the canvas?
And each button need to have two events that need to be fired on
click. Can anyone help me with this?



Thanks

Replies

Highlighted

Avatar

Avatar

riesvantwisk

Avatar

riesvantwisk

riesvantwisk

16-09-2008

you need to create these by hand by 'looping' over your XML



something like var but:Button = new Button();

but.foo = bar;

but.bar = xxx;

but.x = somevalue;

but.y = somevalue;

...

...

somecanvas.addChild(but).



That's how we do it...



Ries