Yes, you are right. This would be cool. I think that need more optimzation and functionality. It's a midnight version of it. :-)
I found some blog's saying that the comboBox or any other UI based on listRendering need this kind of behaviour, I think that they need To. So here come the changes. Can I detect if the dataProvider of the combo change.? I suppose yes. It's a good idea to map the dataProvider.? Map the object will do more faster the task of select an item. I will play a litle more with it. Thanks for your feedback! --- In [email protected], EECOLOR <[EMAIL PROTECTED]> wrote: > > Hello, > > first i must say that i do not agree with "I think that Adobe must provide > this functionality", i personally never used this functionality and besides > that, i dont think it should a part of the combobox itself. I mean, what if > you want the same functionality for a listbox, datagrid or any other > component. > > But hey, you need it, so you make and better even: you shared it :) > > I looked at your code and i would do it differently. Every time the > selectedIndexData property is set you loop over the complete dataprovider, > this is a quite expensive routine. It would be more smart to loop through > the dataprovider once and map each object to an index. Something like this: > > var dataField_str:String = "data"; > var map_obj:Object = new Object(); > var length_int:int = dataProvider.length; > var item_obj:Object; > var value:String; > > while (length_int--) > { > item_obj = dataProvider[length_int]; > value = item_obj[dataField_str]; > map_obj[value] = lenth_int; > }; > > This way you can find the index of an item without looping. > > Lets say at some point you sort the dataProvider. If the dataProvider is > wrapped into (lets say) an array collection. You can subscribe yourself to > the appropriate change event and remake your map. > > I hope this helps in any way. > > > Greetz Erik > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

