First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Simon Bolus | Website: http://www.graphicinjection.co.uk

Constructing the Back and Forward Buttons (2)

For the back button logic: Create a new movie clip call it backLogic - add 2 key frames in the time line, in the first key frame put the code:

if (_root.back.length>1) {
    _root.backButton.gotoAndStop(2);
} else {
    _root.backButton.gotoAndStop(1);
}

This checks to see if the length of the array has more than one value (more than one value is needed to make the back button necessary , i.e. we don't need it to go back to the frame we are already on) If this is true the code instructs the backButton movie clip instance to goto and stop on frame 2 of its time line which is where the back button sits. If the statement is false the code instructs the movieclip to goto and stop on frame 1

Now put this in the second key frame:

gotoAndPlay (1);

This loops the movie clip so it will keep on checking.

Now drag an instance of this logic movie clip on to the main stage put it next to the back button.

The forward button logic is slightly different: Do the same as above but call it forwardLogic and put this code in the first key frame:

if (_root.forward.length>=1) {
    _root.forwardButton.gotoAndStop(2);
} else {
    _root.forwardButton.gotoAndStop(1);
}

The only difference this has to the back button is that it checks to see if there are any values in the forward array i.e. 1 or more (>=1).

Don't forget the gotoAndPlay (1) in frame 2, now drag an instance of this logic movie clip on to the stage put it next to the forward button.

That's it test your movie and your away, any problems go back and check the code or cross reference it with my movie in the download. You could also try using flash's debugger in test movie to check if the variables and arrays are working properly

Hope this tutorial was useful, have fun!!!!!

» Level Advanced

Added: 2001-03-14
Rating: 6.75 Votes: 64
(10 being the highest)
» Author
No details available.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.