A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Combo box

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Posts
    25

    Combo box

    I have a combo box on frame 1 and two items in it's list which I need them to do some basic function which is jumping within a frames.

    By selecting item one will jump to frame 2 and by selecting item two will jump to frame 3.

    how to do that?

    Please see the demo

    http://img81.imageshack.us/img81/1515/comboboxak6.swf

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    in the properties of you for the value of the items either set the number of the frame (works well if you have 0 tweens) or the name of your named frame (best when using tweens) then in the properties of the combobox scroll down a little and you will find Actions select that to open the actionscript editor for the onChanged event of the combobox. Then you can use

    _root.gotoAndStop(this.getValue())
    Attached Files Attached Files
    Last edited by blanius; 07-08-2008 at 10:22 PM.

  3. #3
    Junior Member
    Join Date
    Jul 2008
    Posts
    25
    Thank you very much Blanius. the attachment helps alot, but still I want to know how that code works, by just copy and paste the code did not work for me. I am sure doing something wrong.

    _root.gotoAndStop(this.getValue()) Ok let break down the code please

    _root is items of the combo box or combo box itself?

    gotoAndStop I know what it means but then where is the target? in flash we have something like this

    gotoAndStop("Scene 1", frame 2);

    This = is this the item text in combo box?

    ( .getValue()) = is this frame name /number?

    I would really appreciate your kind help and I just wonder how KM approach AS!
    Last edited by ghol; 07-09-2008 at 01:21 AM.

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    since this code is INSIDE the combobox this will refer to the combobox. to refer to the movieclip that contains the combobox you must refer to it, In my example it's in the root timeline so _root refers to the root movie and that is the one we want to change frames, yes?

    gotoAndStop targets the current movieclip (including buttons, and comboboxes) unless you put either _parent or _root therefore _root.gotoAndStop(this.getValue())

    this.getValue() will equal whatever the selected item in the combobox contains in the value and can be either a string or number depends on the contents of the combobox in the example I used a simple number.

  5. #5
    Junior Member
    Join Date
    Jul 2008
    Posts
    25
    thank you again

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