A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: (mx2004) combobox top text

  1. #1
    Member
    Join Date
    Sep 2003
    Posts
    39

    (mx2004) combobox top text

    Hi,

    I'm having trouble getting a selected text to appear at the top of a combobox... I'm attaching it like this

    Code:
    var pullDown:ComboBox = attachMovie('ComboBox', 'myPullDown', 450);
    pullDown.addItem('item1');
    pullDown.addItem('item2');
    ...
    pullDown.selectedIndex=0;
    and then selecting the top item to be shown... but though the item appears selected when the list drops down, it doesn't appear at the top. Even when I select it manually, the label doesn't show at the top... I thought this would be standard functionality for a comboBox? How do I get it show?

    thanks in advance for any responses,
    3rdw0rld3r

  2. #2
    Member
    Join Date
    Sep 2003
    Posts
    39

    update

    I posted the wrong code by mistake, here's the right one:

    Code:
    var pullDown:ComboBox = createClassObject(mx.controls.ComboBox, "myPullDown", 450);
    pullDown.addItem('item1');
    pullDown.addItem('item2');
    ...
    pullDown.selectedIndex=0;
    sorry, not enough sleep...

  3. #3
    Italy Novik2000's Avatar
    Join Date
    Jun 2001
    Posts
    360
    well, it about half year after ya asked this question but i got this problem too and i found the right code.
    Code:
          var c:ComboBox;
          c.addItem("food",0);
          c.addItem("clothes",1);
          c.addItem("tour"),2;
          c.selectedIndex = 2;
    this code tell the comboBox that "tour" will be the selected value and will be shown at the textfield.
    hope it helped any1.
    Last edited by Novik2000; 06-02-2010 at 04:28 AM.

  4. #4
    Member
    Join Date
    Sep 2003
    Posts
    39
    Hi Avi,

    thanks for your reply... I fixed this way back when, but don't remember how. your code looks the same as mine, only for explicitly defining the position?

    best
    Oliver

  5. #5
    Italy Novik2000's Avatar
    Join Date
    Jun 2001
    Posts
    360
    well i didnt understand what u mean but yes, my code is like your, it just looks simplier... i think.

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