PDA

View Full Version : Listbox: Select Item using AS?


Xenith
12-10-2004, 08:08 PM
How can I have a Listbox that is dynmically populated start with the first item selected?

I know there has to be a way
http://www.flashkit.com/movies/Scripting/Control/Smart_Li-Konstant-2652/index.php

I think it would probably have to go or do something with this frame which is where it is populated?


stop();

List.onLoad=function(){
List.setAutoHideScrollBar(true);
p=new Array( p0 , p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20);
num = picture;
for(i=0; i<=num-1; i++){
List.addItem(p[i],"image/"+"picture"+i+".jpg");
gotoAndStop("label0");
}
}

Ultran
07-31-2005, 09:28 PM
I'm looking for this myself. Anyone know?

jsebrech
08-01-2005, 07:52 AM
Can't you do it with selectedIndex (http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?href=00002519.html)?

Ultran
08-01-2005, 03:15 PM
Yep! Thanks for the reply. I found it this morning. It would be theListBox.setSelectedIndex(indexNum);

For some reason I kept trying to use theListBox.selectedIndex(indexNum);