Welcome, Guest
  • Author Topic: Help in Combo Box & List Box  (Read 3117 times)

    Surajit

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • Email
    Help in Combo Box & List Box
    « on: 12/09/04, 20:10 »
    I am intermediate in Flash & I would like to know whether i can assign a action in Combo Box & List Box. such as selecting one name in combo box it will go the some specific frame label or frame number.

    I had seen that on selecting combo box, it open a new browser window. Can the action may applied to go the specific frame number or label.

    Thanks in advance for anyone helping.

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Help in Combo Box & List Box
    « Reply #1 on: 12/10/04, 07:16 »
    Hi Surajit, welcome to the Boards !

    having a combobox named myCombo, try:

    listener = new Object()
    listener.change = function(){
     //your action
    }
    myCombo.addEventListener("change", listener)

    Jorge

    Surajit

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • Email
    Re:Help in Combo Box & List Box
    « Reply #2 on: 12/10/04, 14:03 »
    Thanks for such a quick & great answer.

    I would again required your help, I just want clicking on each item it should go to specific frame label or frame number. As per your answer it goes to the frame label & frame number but on selecting any thing.

    I would be grateful if you could help me out.  Suppose there are 8 names in combo box & selecting one it should go to frame 10 & on selecting two it should go to frame 15 & so on.

    Awaiting for your reply & quick answer.

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Help in Combo Box & List Box
    « Reply #3 on: 12/10/04, 14:32 »
    Add label and data to the combobox using the Properties Panel. Put any label you want and in data, the name of the frame should go when seected. Then modify the script

    [script]
    listener = new Object()
    listener.change = function(obj){
      _root.gotoAndStop(obj.target.selectedItem.data)

    }
    myCombo.addEventListener("change", listener)
    [/script]

    Jorge

    Surajit

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • Email
    Re:Help in Combo Box & List Box
    « Reply #4 on: 12/11/04, 04:40 »
    Thanks for prompt reply. But i am unable to understand the script. Can you please tell me how should i do it

    Suppose
    my combo box name is "mycombo"
    my label is "01" "02" "03" "04"
    & my data is "01" "02" "03" "04"

    kindly help me out

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Help in Combo Box & List Box
    « Reply #5 on: 12/11/04, 04:59 »
    If you want that your label "01" go to frame 5, you write "01" for label and 5 for data, if your label "02" should go to frame 10, you write "02" for label and 10 for data and so on.

    Jorge

    Surajit

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • Email
    Re:Help in Combo Box & List Box
    « Reply #6 on: 12/11/04, 05:11 »
    Thankyou for your prompt reply & such a great help.

    You are really too good in flash.


    Surajit

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • Email
    Re:Help in Combo Box & List Box
    « Reply #7 on: 12/11/04, 06:46 »
    Is this script will be also be same for the list box??

    one more thing,
    suppose i there are two combo box & a go button

    1st Combo box contains
    001
    002
    003
    004
    005
    006

    2nd Combo Box contains
    012
    013
    014
    015
    016
    017


    If i select 001 from 1st combo box & 014 from 2nd combo box & clicks on go button can it go to specific frame & vice-versa. If yes, kindly help me out.  

    I am targeting on combo box & what other facilities does flash offers to users

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Help in Combo Box & List Box
    « Reply #8 on: 12/11/04, 07:02 »
    List works on the same way.

    You can call a function from your button to capture selectedItem on both comboboxes. To hardcode the capture use the combobox names:

    frame1 = myCombo.selectedItem.data
    frame2 = myOtherCombo.selectedItem.data

    Jorge

    Surajit

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • Email
    Re:Help in Combo Box & List Box
    « Reply #9 on: 12/11/04, 07:20 »
    Once again thank you for prompt reply.

    But this time i am unable to get the settings u said

    suppose i there are two combo box & a go button
    1st Combo box contains
    a
    b
    c
    c
    d
    e

    2nd Combo Box contains
    f
    g
    h
    i
    j
    k


    If i select "e" from 1st combo box & "f" from 2nd combo box & clicks on go button can it go to frame number 15

    If i select "c" from 1st combo box & "k" from 2nd combo box & clicks on go button can it go to frame number 25

    Please let me know the detail procedure for it, so that it will be easy to understand.

    Awaiting for your reply

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Help in Combo Box & List Box
    « Reply #10 on: 12/11/04, 08:56 »
    Call a function like this:

    function toFrame(){
     frame = Number(myCombo.selectedItem.data) + Number(myOtherCombo.selectedItem.data)
     _root.gotoAndStop(frame)
    }

    Data (not labels) in combobox should have the proper frame number. So if letter "e" plus letter
     "f" should go to frame 15, the data for the first could be 10, for the second 5

    Jorge

    Surajit

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • Email
    Re:Help in Combo Box & List Box
    « Reply #11 on: 12/11/04, 13:13 »
    Can you clarify these what action should i give to the "go" button & where should i place this

    function toFrame(){
      frame = Number(myCombo.selectedItem.data) + Number(myOtherCombo.selectedItem.data)
      _root.gotoAndStop(frame)
    }

    for reference i am sending you the file
    http://www.acmevac.com/flash-files/combo-double.zip
    -----------------------------------------------------------------------------


    I had been successful with the script of combo box. I had also applied it to list box in the same file with script like this

    combo box "myCombo" script

    listener = new Object()
    listener.change = function(obj){
      _root.gotoAndStop(obj.target.selectedItem.data)

    }
    myCombo.addEventListener("change", listener)


    & for list box "myList01" script

    listener01 = new Object()
    listener01.change = function(obj){
      _root.gotoAndStop(obj.target.selectedItem.data)

    }
    myList01.addEventListener("change", listener01)

    When i select a category from combo box, it opens list box but when i click it does not perform but when once again i click on combo box & select different category then it works.

    I want to create no. of list box when clicked on combo category. kindly help me out

    I am giving reference file

    http://www.acmevac.com/flash-files/combo-list.zip
    « Last Edit: 12/11/04, 13:14 by Surajit »

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:Help in Combo Box & List Box
    « Reply #12 on: 12/12/04, 14:33 »
    How to call a function from a button ??????

    myButon.onPress = function(){
     somefunction()
    }

    Jorge

    Surajit

    • Server what's that
    • *
    • Posts: 10
      • View Profile
      • Email
    Re:Help in Combo Box & List Box
    « Reply #13 on: 12/12/04, 15:07 »
    Sorry to trouble you again. But i am unable to get it.

    Please clarify it.
    I had also send you the fla's, if you could help me out I would be thankful to you

    Awaiting for your reply