-
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
-
1 Attachment(s)
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())
-
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!
-
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.
-