I am using animated movie clips as buttons in a site I am developing. You rollover the clip (button) and a fade builds, then upon rollout, the fade slowly dissapears. (simular to www.nike.com’s new menu system)
Now, how do I make this clip (acting as a button) go to different scence in my movie? Am I retarded because this really easy? I am sure I will feel that way once I find out how… I tried onClipEvent, tellTarget, goto… not having any luck.
Here is my code in the clip:
on (rollOver) {
if (Number(_currentframe) == 1) {
gotoAndPlay(2);
} else if (Number(_currentframe) == 20) {
stop();
} else {
gotoAndPlay(15-_currentframe);
}
}
on (rollOut) {
if (Number(_currentframe) == 5) {
gotoAndPlay(6);
} else {
gotoAndPlay(15-_currentframe);
}
}
No your not reteraded, you need to refer to the main timeline, since our buttons are in movieclips.
[AS]
on (rollOver) {
if (Number(_currentframe) == 1) {
this.gotoAndPlay(2);
} else if (Number(_currentframe) == 20) {
stop();
} else {
this.gotoAndPlay(15-_currentframe);
}
}
on (rollOut) {
if (Number(_currentframe) == 5) {
this.gotoAndPlay(6);
} else {
this.gotoAndPlay(15-_currentframe);
}
}
[/AS]
Are they buttons within clips or clips as buttons ???
what you want to accomplish isn’t so confusing but what you say you allready have is, kindOf … best I can say is do something as this:
[AS]on (rollOver){
this.gotoAndPlay(2);
};
on (rollOut) {
this.gotoAndPlay(6);
};
on (release){
_root.gotoAndPlay(frameNumber);
}[/AS]
(replace “frameNumber” with a number only)
I am supposing it is only your _root timeline that you want to move … else if there is another clip involved to react to the “on-release” you’ll need to also get the path correct
( ie: _root.clipName.gotoAndPlay() )
BTW:Scenes are more for keeping things segregated within the authoring environment and not good for navigating thru the finished movie as they all get put together on the timeline at publish time … better to have clips, levels and external swfs invoked within the main movie than a lot of playhead travel on the main timeline
All: I tried a couple of the above pieces and it still isnt working for me. It just randomly jumps to a scene instead of going to the intended. Do I attach code to the clip outside or inside the clip for the goto info?
BigBadWold: I’ll create a tutorial for this once I figure this out myself…
? i’m confused. your original script didn’t have an on(release).
sry for the confusion but if you want to make your button inside your movie clip go to a scene or frame it goes like this:
[AS]
on(release){
this.gotoAndPlay(“Scene 2”);
}
[/AS]
Is that what you meant? Oh and your not a pain, and your welcome
Cool… I figured it out. Once I drag one of my clips (being used as a button) out onto the stage, I then need to attach the folowing code to it to make it work and send the playhead to different scenes: