christie_richards
christie_richards

Reputation: 1

How to return to previous slide in Actionscript

I have written a game in Flash and I am trying to implement an instructions feature which can be accessed throughout the game. Basically you click the instructions (question mark) icon at the top right and it will display a tutorial animation.

The thing is after this is that I need a button to link back to the slide they were originally on. I can't define a specific frame with gotoAndPlay(1); etc as they can access the information from any part of the game and prevFrame(); doesn't work because it goes back to the previous frame within the animation rather than the previous page on the game.

Sorry I hope that makes sense and I hope someone can help!

Thank you

Upvotes: 0

Views: 97

Answers (1)

Craig
Craig

Reputation: 814

You've discovered why it's good idea to learn class-conscious actionscript coding, and to avoid frame-based coding.

But a simple way to solve your problem, for now, would be to have the instructions (one screen's worth, or more?) always on stage but invisible. So put the instructions in a MovieClip. Position it on stage and give it an instance name of, say, 'instructions'

In your first frame set instructions.visible = false. Have a button that's always onstage and that simply sets your instructions.visible = true when clicked once, and that re-sets instructions.visible = false when clicked again.

There's a bit more to figure out but that will get you started.

It's always a good idea when you're trying to solve a programming problem to construct the simplest possible model of the problem, away from the complexities of your current project. So in this case you might create, for experimenting, a simple Flash project with, say, 2 frames, an 'instructions' MovieClip, and a button. If you can make that work you can bring the idea back to your main project.

Upvotes: 1

Related Questions