Can buttons work within a movie clip on a stage (scene 1)and go to different scenes (scene 2)?
I can’t figure it out.
Yes they can Melissa, just have your button target a frame label on the next scene. Here’s an example to help you better understand what I’m talking about. =)
I posted the same question, it seams that it cant be done with traditional means but if you build a button in your movie and attach code like this:
on (release) {
_parent.gotoAndPlay(2)
}
now in your root scene you can put your goto script in frame 2.
so when you release the button on the stage it will go to your root scene and play the script in frame to which can goto another scene.
check my post for additional help.
this is what you can have on your buttons if you want it to go to a diffrent scene:
on (release) {
gotoAndPlay(“Scene 1”, 1);
}
where “scene 1” you can change it to whatever scene you want it to be scene 3, 4 , 5 etc.
then after see how u have the number “1” well that is telling it to go to frame 1, if you want it to go to another frame, like 20, the code should read this :
on (release) {
gotoAndPlay(“Scene 1”, 20);
}
Hope that helps, feel free to ask!
It can also be “gotoAndStop” instead of “gotoAndPLay” depending on what u want it to do!
<:}
sorry dave, I don’t mean to butt in, but your method won’t work if the button is sitting inside a movie clip. Those actions you posted would work if the button was just sitting on the main timeline. In Melissa’s case, she has a button that is inside a movieclip so the only way I know was to target frame labels by applying this action to the button:
on (release) {
_root.gotoAndPlay("blah");
}
“blah” would be the frame label in scene 2. =)
Does that work electrongeek?
The only way I have figured out to change scenes from inside a movie clip is to target a frame on the _root timeline that houses the gotoAndPlay(scene) AS code in it.
Maybe I did it wrong when I tried the frame label thing. It was long ago, I can’t remember.
Yea for some wierd reason it does work, check out the sample fla ablove that I made for Melissa and you’ll see what I mean.
Hmm, interesting.
I learn something new everyday.
Thank you all !!i have been trying different things all week…thanx to electrongeek…!
Hi, guyz got the same sort of problem!
I have a MC, within it is a button (which will be duplicated many times!
I want to play an animation when the button is roll over and rolled off. what is the best way to do this?
Thw code I used works if the animation is on the root, so what is the syntax to target the animation within a mc.
on (rollOver) {
tellTarget ("_root.button") {
gotoAndPlay (2);
}
}
on (rollOut) {
tellTarget ("_root.button") {
gotoAndPlay (11);
}
}
Thanks
Kev
tellTarget isn’t used anymore. And if you want it to target the mc you are rolling over, use your MC as a button.
Create a movie clip symbol, inside create your animation.
Then on the movie clip symbol itself, use this…
on (rollOver) {
this.gotoAndPlay(2)
}
on (rollOut) {
this.gotoAndPlay(11)
}
}
lostinbeta - just tried the script - can’t get it to work! I am using Flash 5 though, this might be the problem!
Is there another way, I’ll re-cap:
I have a movie clip, within it are several instances of ther same button, within the button is another MC (call it b1). I need to target the b1 on roll over and also on roll out!
Hope you can help!
Kev
Yeah, you can only use movie clips as buttons in Flash MX, which brings us to the question: why did you post a Flash 5 question in the Flash MX section?
oops, sorry about that. I did a search on the subject and just followed a few links from the threads! I did not notice the section.
Shall I craete a new thread under F5?
Kev
No, don’t worry about it.
An easy way to do it in Flash 5 is to create the button symbol, then double click it to edit it. Put a movie clip symbol in the appropriate frames and inside those movie clips create your animation. That way your animation will play when you activate the correct state.
Yes I did that in the first place with two animations one fading in on over and the other fading out on roll out! Just thought it could be done with AS!
Sometimes the simplist ways are the best.
Thanks and take care
Kev
In MX it can be done with AS. I don’t know about Flash 5. I have never used it (other than a basic tween or something stupid like that).
Ok, thanks for all your help!
Kev
No problem. Sorry I couldn’t help more though.