First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Clinton Montague

The Next Background Button

Open up the actions panel up for the button that you want to change the background to the next one. It is sensible to put this one on the right hand side, but it does not matter. Type in the following script.

on (release) {
   a += 1;
      if(a == 5) {
         a = 1;
         _root.Back.gotoAndPlay ("BG" add a);
      else {
         _root.Back.gotoAndPlay ("BG" add a);

You might now be able to see how this script works without me explaining it now because it is very similar to the previous background actionscript. I won't explain it all this time, just a few key points that have changed.

  • The a += 1 does the opposite of a -= 1. It adds one onto a instead of taking one away. It is the same as a = a + 1.

  • This time, the IF checks to see whether a is 5, there is no background for 5 so you have to reset a back to 1.

The rest of the actionscript does exactly the same, so if you don't fully understand it, you should look back over it.

Thats it! You should now have a Flash movie that changes the background whenever the user clicks a button to change it. Click on Control >> Test Movie (CTRL and ENTER / CMD and RETURN) to try it out.

My finished movie is shown below I also added an extra text box to tell you what the value of the variable a is so that you can see what is happening inside the movie.

» Level Intermediate

Added: 2001-03-14
Rating: 7.82 Votes: 39
(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!


  • 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: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
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: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.