A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: Major Combo Box Question

  1. #1
    Member
    Join Date
    Oct 2002
    Posts
    61

    Major Combo Box Question

    I have numerous combo boxes, input boxes and calculations which need to work backwards and forwards no matter which variable is selected.

    Is it possible to change what a combo box value displays when another combo box is used.

    For example I have 2 combo boxes
    one has A B C D etc.
    the other has 1 2 3 4
    When I select C on the first it changes the 2nd to display 3.

    Do you understand what I'm trying to say here?

    Thanks
    I can always use more help!

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    I think I do... But it would be easier if you attached your .fla or a mock up, for me(us) to better understand it, and not have to re-create it based on the little info provided.

  3. #3
    Member
    Join Date
    Oct 2002
    Posts
    61
    thanks for the quick reply

    I dont know how to attach any thing as I'm real new to posting.
    Please tell me more.

    Basically,

    all want to do is change what is selected in a combobox without physically selecting it.
    Combobox1 1 2 3 4
    with value 1 2 3 4
    when I type 3 in a text box it displays a selected 3 on the combobox and if I typed getValue it would display 3 without having to physically select.

    Thanks
    I can always use more help!

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    When you make a post, there's a box at the bottom of the post form that says Attach File... Just hit the Browse button to the right of it and attach the .fla you've got!

  5. #5
    Member
    Join Date
    Oct 2002
    Posts
    61
    This is just mock file that I quickly threw together.

    the code is found on the invisible movie clip

    as you can see it doesn't work but I want it to basically do what I typed onto the movie clip

    What do I need to know?

    If I need to make it clearer just ask
    I can always use more help!

  6. #6
    Flash Product Manager
    Join Date
    Mar 2002
    Posts
    140
    What event do you want to trigger the updating of the other components? Do you mean that you'd like to set the selected item in Combo Box B immediately when a user has selected an option from Combo Box A?

    Try this -
    Code:
    function boxA_cb_handler(){
    	var selectedItem = boxA_cb.getSelectedItem().label;
    	if(selectedItem == "A"){
    		boxB_cb.setSelectedIndex(index);
    		// "index" being the item that you'd like to 
    		// have selected in boxB_cb when "A" is the
    		// selected option
    	} else if (selectedItem == "B"){
    		// and keep repeating this for all options...
    	}
    }
    // this will assign the function above to be called whenever
    // someone selects an item from "boxA_cb"
    boxA_cb.setChangeHandler("foo_cb_handler");
    Of course, this assumes that you have already populated "boxB_cb" with items. If you haven't you can use the "addItem()" method in place of "setSelectedIndex()" and just populate your other combo box manually.

    Cheers,
    MD

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Mike Downey
    Producer | Evangelist
    Macromedia On Demand
    http://www.macromedia.com/ondemand
    mdowney@macromedia.com

    [md]

  7. #7
    Member
    Join Date
    Oct 2002
    Posts
    61
    MD
    I don't want to change any values in the code all I want it to do is automatically change the selection so that when you use if .getValue it will respond with what is selected

    thanks for you help
    it is much appreciated
    I can always use more help!

  8. #8
    Member
    Join Date
    Oct 2002
    Posts
    61
    Thankyou very much MD

    the
    .setSelectedIndex()
    was just what I wanted to know.

    I didn't know if you could do that or not.

    Do you know if you can change the size, shape etc. of the whole combobox.

    Thanks again
    I can always use more help!

  9. #9
    Flash Product Manager
    Join Date
    Mar 2002
    Posts
    140

    Example FLA

    Here's an example that might give you some ideas.
    Attached Files Attached Files

  10. #10
    Member
    Join Date
    Oct 2002
    Posts
    61
    MD
    I'm having about of trouble with which one takes priority, one of them always overpowers whether it is first in the code or it has enterframe selected.

    How can I make them all equal in priority.

    I've updated the combo mock so that it works

    and it now has a text box and 2 combo boxes
    I know need to make them all linked so what is typed or selected affects the other 2 without one overpowering the other
    Attached Files Attached Files
    I can always use more help!

  11. #11
    Member
    Join Date
    Oct 2002
    Posts
    61

    Does anybody know?

    Does anybody know how to link two comboboxes and a textbox without one overpowering the other?

    Any Suggestions?
    I can always use more help!

  12. #12
    Senior Member
    Join Date
    Nov 2002
    Location
    Maryland, USA
    Posts
    428
    What do you mean by over powering???

  13. #13
    Member
    Join Date
    Oct 2002
    Posts
    61
    check out combomock and you will see that I haven't worked how all three can be linked together.

    One will always have priority over the other depending on if it is first in the code or it uses enterframe.

    Please have a look at my file and see if you can suggest something.
    I can always use more help!

  14. #14
    Member
    Join Date
    Oct 2002
    Posts
    61

    What I have is a ciruclar reference

    What I have is a circular reference and I need to overcome it with the last selection of either of the combo boxes takes priority.

    Does anybody know how to do this?
    I can always use more help!

  15. #15
    Junior Member
    Join Date
    Sep 2002
    Posts
    23

    question

    if(selectedItem == "Box A - Item 2"){
    var i = 2; // 2 being the 3rd value in boxB_cb *note indexes start counting at 0
    boxB_cb.setSelectedIndex(i);

    Why doesn't it work if I use 0 in the place of 2 for the var i?
    thanks a million!

  16. #16
    Banned
    Join Date
    Apr 2016
    Location
    Bangladesh
    Posts
    9
    Quote Originally Posted by MikeDowney View Post
    Here's an example that might give you some ideas.
    I just see your attached file that really helps ti get idea more,

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