Click to See Complete Forum and Search --> : [RESOLVED] Target specific combobox item
jweeks123
07-08-2008, 08:21 AM
How would you go about targetting a specific combobox item selected. Like say I click on the 3rd item in the dropdown list and then I want to take that item and change it's text format and make it unselectable but keep everything else normal.
Any way of doing this?
Any ideas?
Thanks.
cancerinform
07-08-2008, 09:02 AM
You use this class:
http://flashscript.biz/flashas3/datagrid_list/cellrenderer_2.html
In the drawbackground function you change the textformat and add the line:
enabled=false;
Then when you instantiate the combobox you add this line:
myCombo.dropdown.setStyle ("cellRenderer",MyCellRenderer);
dropdown is the List component for the combobox.
jweeks123
07-08-2008, 09:08 AM
Thanks. I appreciate the info.
I also found this just before I got this reply if anyone else is interested.
Keep in mind this was in a loop referencing comboboxes in a "holderMC" All instance names were stored in an array called cArray.
Hope this helps as well as cancerinforms post.
Thanks again.
//Cell Renderer
var cr:CellRenderer =this.holderMC[cArray[i]].dropdown.itemToCellRenderer(this.holderMC[cArray[i]].dropdown.selectedItem) as CellRenderer;
var listData:ListData = cr.listData;
cr.enabled = false;
trace("You have selected row: " + listData.row);
this.holderMC[cArray[i]].drawNow();
//end Cell Renderer
jweeks123
07-12-2008, 03:36 AM
Also when doing this, you would be better off using the script from cancerinforms post earlier, and setting a style for each combobox cellrenderer your using.
Corresponding post here:
http://board.flashkit.com/board/showthread.php?p=4071330#post4071330
flashkit.com
Copyright Internet.com Inc., All Rights Reserved.