How to add data to a spark list control dynamically -
i have spark list control(id="cclist") in 1 of custom components() , text input control. when value entered text input, want dynamically add same list control. tried doing following :
protected function cc_selecthandler(event:customevent):void
{
var cctext:displayobject = event.data displayobject cclist.enabled = true; cclistbutton.enabled = true; cclist.addchild(cctext);
}
but error saying "addchild() not available in class. instead, use addelement() or modify skin". tried using addelement, apparently isnt available @ all. idea im doing wrong ?
<s:list x="732" y="299" width="191" height="108" id="lstque"> <s:dataprovider> <mx:arraycollection> </mx:arraycollection> </s:dataprovider>
needs dataprovider use additem method. quick , dirty way add blank dataprovider blank arraycollection enclosed.
example of adding through click event.
protected function imgaddtolist_clickhandler(event:mouseevent):void { this.lstque.dataprovider.additem(datagrid.selecteditem.fldvideothumb); }
Comments
Post a Comment