flex - MXML - Create combobox dynamically on click of button -


need on creating combo box dynamically in flex. how create combobox dynamically on click of button.

thanks in advance.

for example:

public function createcombobox_clickhandler(event:event):void {             var mycombobox:combobox = new combobox();             var comboboxdataprovider:arraycollection =new arraycollection([                 { name: "box1", value: "value1"},                 { name: "box2", value: "value2"},                 { name: "box3", value: "value3"},                 { name: "box4", value: "value4"}             ]);              mycombobox.x = 100;             mycombobox.y = 100;             mycombobox.dataprovider = comboboxdataprovider;             mycombobox.labelfield = "name";             mycombobox.addeventlistener(listevent.change, mycombobox_clickhandler);             container.addelement(mycombobox);         }          public function mycombobox_clickhandler(event:listevent):void{             trace(event.currenttarget.selecteditem.value);         } 

and button click (and container them both)

<s:bordercontainer id="container" width="100%" height="100%">     <s:button id="createcomboboxbutton" click="createcombobox_clickhandler(event)" label="create combobox dynamically"/> </s:bordercontainer> 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -