;

PDA

Click to See Complete Forum and Search --> : Dumb Question


xpattech
05-08-2006, 05:11 PM
Ok and yes i should now about this but for the life of me i cant remember or find any info....

Simple 5 item listbox and i need a default already selected...

Thats it....

Once you have all stopped laughing then give me a clue please....

blanius
05-08-2006, 07:38 PM
Not laughing here. I have to look up the API every time.

This is from the example in the folder examples/component/flash 8/


onClipEvent(construct){
width = 190;
height = 80;
boxStyle = 1; // boxStyle 0 = combo, 1 = listbox
c = [0x828b73,0xe9e2da,0xe9e2da,0x9e9f6d,0xaab19a,0xf8f 5f0,0x342d2a,0x544d4a,0xf8f5f0];
}

onClipEvent(load){
items = new Array();
items.push({label:'item 1',value:' value 1',selected:true});
items.push({label:'item 2',value:2});
items.push({label:'item 3',value:3,selected:true});
items.push({label:'item 4',value:'value 4'});
items.push({label:'item 5',value:5});

setItems(items,true,new TextFormat('Arial',12));
onChange = function(){
var v = getValues();
_root.txt1.text = 'You chose ' + v.toString(); // when multiple selection is off, selected value is passed by default.
}
}

Note that 1 and 3 are already selected

w.brants
05-09-2006, 01:17 AM
Another way is to use the setSelected function.