dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Selecting an item in a combo box

  1. #1
    Junior Member
    Join Date
    Jun 2002
    Posts
    13
    I have a combo box with a whole bunch of items, that look like this.
    (Data, Label)
    (1,A)
    (2,B)
    (3,C)
    (4,D)

    How do I make it start with (2,B) selected?

    Thanks,
    Rachel

  2. #2
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    try

    Code:
    myComboBox.setSelectedIndex(1);

  3. #3
    Junior Member
    Join Date
    Jun 2002
    Posts
    13
    Originally posted by chi-styler
    try

    Code:
    myComboBox.setSelectedIndex(1);
    Thanks, but how do I dynamically assign it? I want to be able to pass in either 1 or B, and have it find the index.

  4. #4
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    Then you're going to have to loop through your combobox data and label array until you find the required item, and then keep the index

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