A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: How to use Combo Box

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    3

    How to use Combo Box

    I'm trying to create a drop down menu for a Nokia phone, so I tried to implement a combo box to do it. I can add labels to the drop down but I can't figure out anything else. How can the user select the drop down? I think I used a round about way by creating a button behind the combo box so the user thinks they're selecting the drop down, but they're really selecting the box behind it. So when they press the button, the drop down opens up and you can see the items within it. However, when I try to scroll down the list, it only moves down one item and then selects it when I press down again. How can I make it so that the user can move through the entire list without selecting anything until manually pressing the select button?

    Thanks!

    P.S. I am using Flash for the first time and am learning as I go.

  2. #2
    Moderator
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    components often rely upon mouse driven events and are not usually intended to work with key press types of phone interfaces. Also components tend not to be optimized for performance on low end cpu phones.

    it is likely that there is no ActionScript code within the combo box to enable up down navigation with the up/down buttons. You would have to build this into the code somehow.

    Typically Flash Lite developers create their own user interface elements. Usually developers create code to trap key press events then change visual elements on the screen, such as the focus of a user interface element. This is a much different approach than a mouse driven interface, where all you need to do is create buttons that users point to.
    aviarts.com - web development and flash development

  3. #3
    Senior Member
    Join Date
    Aug 2006
    Posts
    322

    May This Help You

    this is almost do the same thing as a combo box do
    you can try this for your application
    Last edited by marlopax; 09-21-2009 at 06:17 AM.

  4. #4
    Junior Member
    Join Date
    Nov 2008
    Posts
    3
    That's exactly what I need! How do I implement this into my own file? Where is the code for it?

  5. #5
    Senior Member
    Join Date
    Aug 2006
    Posts
    322
    Well, you are welcome nic.
    If you look at my other thread ["YES" and "NO" in Flash lite 1.1 enabled Phone] where I want to share about the Flash Lite 1.1 applications scope and every possibilities of the biggest range of this platform, you will get your answer promptly whenever you ask. But to give a right way for your application you need to construct a perfect architecture of your program. If you let me know what you are going to do and what are the elements you want to put there, then I can try my level to track it in a right way.

    To share more give details of your program here: http://board.flashkit.com/board/showthread.php?t=776258

    I'll try to help

    happy to help

    cheer

    marlopax

  6. #6
    Junior Member
    Join Date
    Nov 2008
    Posts
    3
    I'm trying to create a drop down menu that will display the months of the year and will let me know what option the user has chosen. I've already created all the screens that I need and I'm just trying to implement the drop down menu. I looked at your file from the "YES and NO" thread, but I'm still confused as to how to write it. I just started learning Flash 3 weeks ago so I need a lot of help. Thanks!

  7. #7
    Senior Member
    Join Date
    Aug 2006
    Posts
    322
    see the last sample in [Yes and No]

    marlopax

  8. #8

    Handling Events on a Combo Box

    Here's the code from ComboBoxDemo.java that registers and implements an action listener on the combo box:

    public class ComboBoxDemo ... implements ActionListener {
    . . .
    petList.addActionListener(this) {
    . . .
    public void actionPerformed(ActionEvent e) {
    JComboBox cb = (JComboBox)e.getSource();
    String petName = (String)cb.getSelectedItem();
    updateLabel(petName);
    }
    . . .
    }


    This action listener gets the newly selected item from the combo box, uses it to compute the name of an image file, and updates a label to display the image. The combo box fires an action event when the user selects an item from the combo box's menu. See How to Write an Action Listener, for general information about implementing action listeners.

    Combo boxes also generate item events, which are fired when any of the items' selection state changes. Only one item at a time can be selected in a combo box, so when the user makes a new selection the previously selected item becomes unselected. Thus two item events are fired each time the user selects a different item from the menu. If the user chooses the same item, no item events are fired. Use addItemListener to register an item listener on a combo box. How to Write an Item Listener gives general information about implementing item listeners.

    Although JComboBox inherits methods to register listeners for low-level events — focus, key, and mouse events, for example — we recommend that you don't listen for low-level events on a combo box. Here's why: A combo box is a compound component — it is comprised of two or more other components. The combo box itself fires high-level events such as action events. Its subcomponents fire low-level events such as mouse, key, and focus events. The low-level events and the subcomponent that fires them are look-and-feel-dependent. To avoid writing look-and-feel-dependent code, you should listen only for high-level events on a compound component such as a combo box. For information about events, including a discussion about high- and low-level events, refer to Writing Event Listeners.

    ..........................................
    New York Web design
    Website designers
    Last edited by hkp819; 12-10-2008 at 03:44 AM.

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