Sorry I've been having a bad head day today... but, it's still a case of first having to work out you want to use List.selectedIndex, from the many members of the component; then the documentation is fine granted. Surely it'd be a good idea to include use of selectedIndex in the "Creating an application with the List component" section!!
Generally I feel MM's documentation could be a fair bit better... especially code examples, some of them are like Ebeneezer Scrooge "Muzak" <[EMAIL PROTECTED]> wrote: > Not sure which docs you're using, but here's what's in mine: > > <quote> > List.selectedIndex > > The following example selects the first item in a list by default and displays > the index of the currently selected whenever the user > selects a new item: > > var my_list:mx.controls.List; > > my_list.addItem({data:"flash", label:"Flash"}); > my_list.addItem({data:"dreamweaver", label:"Dreamweaver"}); > my_list.addItem({data:"coldfusion", label:"ColdFusion"}); > > // Select first item by default. > my_list.selectedIndex = 0; > > var listListener:Object = new Object(); > listListener.change = function(evt_obj:Object) { > trace("selectedIndex = " + evt_obj.target.selectedIndex); > } > my_list.addEventListener("change", listListener); > > </quote> > > Muzak > > ----- Original Message ----- > From: "Peter O'Brien" <[EMAIL PROTECTED]> > To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com> > Sent: Friday, October 28, 2005 11:35 AM > Subject: Re: [Flashcoders] Selecting an item off a List component > withactionscript > > > > it would really help if MM would supply more code examples, it's damn > annoying > > for a single developer spending ages trying to find one line of code that is > > no doubt used a great deal > > > > by changing search engines found it: > > articles_list.selectedIndex=0; > > > > > > "Peter O'Brien" <[EMAIL PROTECTED]> wrote: > > > >> Hi List, this concerns you the component. How does one select an item off > a > >> dynamically created List with actionscript? > >> > >> The following: > >> > articles_list.dispatchEvent( {type:'change', target:{value:0}} ); > >> causes the event to fire but not for the item on the List to appear > > selected. > >> > >> Please help me o kings of actionscript! > > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders