A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Dumb Question

  1. #1
    Member
    Join Date
    Apr 2006
    Posts
    61

    Dumb Question

    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....

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Not laughing here. I have to look up the API every time.

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

    code:

    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

  3. #3
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Another way is to use the setSelected function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center