Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use the button and menu from component tray?

Status
Not open for further replies.

gnikollaj

Programmer
Apr 20, 2005
7
US
I am able to turn a graphic into a button and use the on release functions I add to the buttons to work.
The thing I can't get to work is the already in place button component or the menu component that comes with flash mx2004. I was hoping someone could explain/show me how I can use those components. Preferably to have the button go to another frame when clicked. Also, to be able to use a menu for going between frames as well.
I just don't understand why the button in the component tray isn't easier for me to use than my making a symbol button out of an image I import to the stage.
Thanks in advance.
 
Code:
on(click){
//do stuff
}

Menu is more complicated. Both are extensively outlined in the help files. You should be able to find what you need there under Using Components.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
I tried
on (click) {gotoAndPlay(2);
}
and I tried
on (click) {gotoAndStop(2);
}
both with no success. Don't understand why I am having a problem with this.
For buttons I make, I can use on release gotoandplay with no problems.

 
Ok:

on (click) {

//Movieclip GotoAndStop Behavior
this._parent.gotoAndStop("2");
//End Behavior

}
Works for the button component, now if I can figure out how to use the menu component. That would be excellent.
 
Gave it a shot and tried a bunch of things to no avail. It just doesn't work the way I want it to. I think I am trying to do too much with the menu/combobox/listbox components.
When the directions tell you to add the component then delete it, then readd it through actionscript, it just gets too complicated because after that it gets vague when trying to understand where to add the scripting to get the things to appear.
Is it possible to have a combo box list two choices and then when one choice is selected have something occur like, go to a frame?
I see on change, and then I was thinking my var = combobox.selected index, but then how do I take this var to say well if index one of the combobox was selected, go to frame 30, if index two was selected go to frame 15?
 
When you say:
Quote:
Create a combo box, stick this code on the same timeline the combo box is on:

Paste the code onto the actions for the stage or for the actions of the combobox? I am guessing combobox, but since I am not sure I am asking.

In the line:
comboBoxInstance.dataProvider = [1, 2, 3, 4, 5, 6, 7, 8, 9];
Is this an array of the possible number of selections I will have?
So if I only want two choices for selection from the dropdown, should it be
comboBoxInstance.dataProvider = [1, 2];
Is there suppose to be a zero if it is?
comboBoxInstance.dataProvider = [0, 1];

In the line:
{ var frame:Number = eventObject.target.selectedItem;
gotoAndStop (frame);
};
How do I control which selection will go to a certain frame. It seems to me this is only for one selection, but which one? Do I take Number and place in the index I want to relate to that frame to go to and just make a number of copies of this line to have each selection go to the frame I want?
For Example:
{ var frame:0 = eventObject.target.selectedItem;
gotoAndStop (10);
var frame:1 = eventObject.target.selectedItem;
gotoAndStop (5);
};

Thanks so much for showing this. If someone could please explain it some more, I would really appreciate it. I hope I am somewhere near understanding, but I can guess I am way off too.
Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top