ComboBox select Item

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default ComboBox select Item

    Hi all,

    i have a combobox with n entities - and on init i want to select e.g. the
    second entity. I tried to use selectedItem, getChildAt and and and.. and it
    doesn't work.

    Please give me a hint how to get this working!

    Thanks,

    Michael

    MichaelDiederich Guest

  2. Similar Questions and Discussions

    1. Select a dataProvider with a ComboBox
      When the user makes a selection from a ComboBox (of a list of subjects), how do I tell the dataProvider of the display element that the dataProvider...
    2. Multiple Item selection in comboBox
      Can combo box be used to selected multiple items at a time?
    3. Unable to retain the selected item in the comboBox usingselectedIndex
      Unable to retain the selected item in the comboBox using selectedIndex I have been using two components and the combo in the child component is...
    4. xml - how to select next item in loop?
      Hello, Sorry to crosspost, just didn't know which group was more relevant. I am importing an xml file into my flash and assigning the value...
    5. how to disable item in combobox
      hello, Can any body tell me how to disable item in comboBox. i dont want to disable comboBox, i want only few item of it to be disable in...
  3. #2

    Default Re: ComboBox select Item

    I guess, your requirement is to select second element from combo box on page
    load .if I am not wrong.
    If my anticipation is right then,here i go,
    you just have to call the init method in Application tag using initialize or
    creationComplete.
    like,
    <mx:Application ...........initialize= "init();">
    (note: if initialize doesnt work use creationComplete = "init() )

    //define init method as
    <mx:Script>
    function init()
    {
    comboID.selectedIndex=2;
    }
    </mx:Script>
    meticoolus Guest

  4. #3

    Default Re: ComboBox select Item

    function preSetItemCombox(obj:Object,DefaultItem:String){
    var aDP:Array = mx.utils.ArrayUtil.toArray(obj.dataProvider);
    var sDataValueInit:String = DefaultItem;
    var sDataValueCur:String;
    for ( var i:Number=0; i<aDP.length; i++ ) {
    sDataValueCur = aDP[i].data;
    if ( sDataValueCur == sDataValueInit) {
    obj.selectedIndex = i;
    }
    }
    }

    Lu BaoGuo Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139