-
Frame buttons
I'm terrible at Actionscript no matter what version it is. Call me a bad programmer and everything.
I'm made my slide show (something to do with the video game franchise F-Zero) for Web Page Design class and I'm nearly completed. All I have to do is make some buttons that lets you go to either the next or previous frame. I done so but every time I do such, I keep getting these Syntax errors (I don't remember what they were). Now my brain cells are mushed and I deleted the buttons and now I don't know what to do. I have to get it finished by tomorrow (or Friday if schools closed tomorrow due to February Fury; I doubt it).
I'm terribly sorry for saying this, but can anyone make a button for me? I've searched on Google yet no solution. Would credit make you feel any better?
Download link: http://rapidshare.com/files/34863602...eshow.fla.html
-
-
I really don't know how to use action script.
-
-
I can't do actionscript that great.
-
You probably didn't get any responses since this thread was posted when most of the members are asleep.
To make a movieclip do something when you click it, you need to add an event listener for MouseEvent.click to it.
If you next button has the instancename "nextButton", and the next slide frame has the label "nextSlideLabel" then this code will make your movie advance when you click the button.
Code:
nextButton.addEventListener(MouseEvent.CLICK, goForward);
function goForward(e:MouseEvent):void{
gotoAndStop("nextSlideLabel");
}
To go backward, if your previous slideLabel was "prevSlide", then just use that as the argument to gotoAndStop.
-
Originally Posted by 5TonsOfFlax
You probably didn't get any responses since this thread was posted when most of the members are asleep.
To make a movieclip do something when you click it, you need to add an event listener for MouseEvent.click to it.
If you next button has the instancename "nextButton", and the next slide frame has the label "nextSlideLabel" then this code will make your movie advance when you click the button.
Code:
nextButton.addEventListener(MouseEvent.CLICK, goForward);
function goForward(e:MouseEvent):void{
gotoAndStop("nextSlideLabel");
}
To go backward, if your previous slideLabel was "prevSlide", then just use that as the argument to gotoAndStop.
I kinda got stumped after making the "nextButton".
-
Where are you stumped?
I take it you have a movieclip on a frame somewhere named "nextButton".
In the actions for that frame, put the code above. Name your frames appropriately.
-
Originally Posted by 5TonsOfFlax
Where are you stumped?
I take it you have a movieclip on a frame somewhere named "nextButton".
In the actions for that frame, put the code above. Name your frames appropriately.
What I was saying is, "Where should I put the code at? On the frame outside the button or inside the button?"
-
Frame outside that button.
-
Originally Posted by 5TonsOfFlax
Frame outside that button.
http://rapidshare.com/files/34921964...48894042592467
Now I'm getting errors that are telling me that I have duplicate layers. Can you check and see what I did wrong?
-
No, I can't. I don't have Flash installed on my work computer.
If you mean duplicate label, then you've probably tried to actually label your frames prevSlideLabel and nextSlideLabel on more than one frame. Labels must be unique. I just used those to illustrate how to go to a particular frame.
-
Originally Posted by 5TonsOfFlax
No, I can't. I don't have Flash installed on my work computer.
If you mean duplicate label, then you've probably tried to actually label your frames prevSlideLabel and nextSlideLabel on more than one frame. Labels must be unique. I just used those to illustrate how to go to a particular frame.
You have it at home? Oh! Okay. I'll try.
-
Originally Posted by 5TonsOfFlax
No, I can't. I don't have Flash installed on my work computer.
If you mean duplicate label, then you've probably tried to actually label your frames prevSlideLabel and nextSlideLabel on more than one frame. Labels must be unique. I just used those to illustrate how to go to a particular frame.
OK. Done what you said, but now my movie won't stop. where should I put the "stop;" action code at?
-
If you used gotoAndStop, it shouldn't continue playing. I suppose you could put stop() in the actions for the destination frame.
-
Originally Posted by 5TonsOfFlax
If you used gotoAndStop, it shouldn't continue playing. I suppose you could put stop() in the actions for the destination frame.
So I should put the "stop();" code on top of the other code, right? Or would it screw up?
-
It should go at the top of the destination frame(s). stop() doesn't prevent code from executing, it only prevents the playhead from advancing. So it shouldn't screw anything up.
-
Originally Posted by 5TonsOfFlax
It should go at the top of the destination frame(s). stop() doesn't prevent code from executing, it only prevents the playhead from advancing. So it shouldn't screw anything up.
Didn't work.
My code:
Code:
stop();
nextButton.addEventListener(MouseEvent.CLICK, goForward);
function goForward(e:MouseEvent):void{
gotoAndStop("nextSlideLabel");
}
I've definitly done something wrong. May have something to do with the layers.
-
There's definitely something wrong. gotoAndStop should prevent it from advancing once it's gone to the other frame on its own. But you put stop on the wrong frame. I meant the destination frame - the one that you are going to. Which in this case is nextSlideLabel.
If you are not already, use the debug player. Report any error messages that you are getting.
-
Originally Posted by 5TonsOfFlax
There's definitely something wrong. gotoAndStop should prevent it from advancing once it's gone to the other frame on its own. But you put stop on the wrong frame. I meant the destination frame - the one that you are going to. Which in this case is nextSlideLabel.
If you are not already, use the debug player. Report any error messages that you are getting.
I already put those codes in those frames [the ones labeled "nextSlideLabel(#)"].
I forgot to mention my layers:
Music: For background music.
Text: For storytelling.
Images: My drawings to illustrate to story.
Preloader: Newgrounds preloader.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|