A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11337 Flash Movies | 1 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Bugra Ozden
» Title: Skatalog v9 - product catalog
» Description: Create your product catalog easly and publish on your website or Create your image gallery, documents list, portfolio. Fully XML Driven
» More by Bugra Ozden


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5828 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: Creative DW Image Show PRO
» Description: Creative DW Image Show PRO is a Dreamweaver extension which enables the user to create multimedia presentations. It combines the features of the popular Creative DW Image Show with the ability to add professional text effects to slides (similar to After Effects). The product is very customizable: the user can choose the duration of the transition effects, the slide motion start and end position, zoom and panning type for both images and texts.


Random Links | Add your own Flash Related Links
Flash Tutorials 1280 Tutorials 7 New Tutorials Added!
What's New | Top100

» Make a Flash Slide Show Screen Saver
» Simple flash making tutorial for thanksgiving
» Create flash banner for website
» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» Unknown Tag: Title10
Random Tutorial | Add Site

Trading Customer Accounting (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Interactivity/Other

Categories Interactive Background
Author: Clinton Montague

 
Page 4
«prev 1 2 3 4 5 next»

The Previous Background Button

Open up the actions panel for the button that you want to change the background to the previous one. It is sensible to use a button on the left to do this but it does not matter. In the actions panel, type in the following script (again, Expert Mode is probably best.)

on (release) {
 a -= 1;
 if(a == 0) {
 a = 4;
 _root.Back.gotoAndPlay ("BG" add a);
 }
 else {
 _root.Back.gotoAndPlay ("BG" add a);
 }
textName=name[a]
}

This script might look horrible but it is actually quite simple if you look at it one step at a time.

  • The on (release) tells Flash to do the instructions that follow when the user releases the mouse button.


  • The a -= 1 is a short and lazy way of writing a = a - 1, they both mean the same thing. If a was 3 for example, Flash would take 1 away from 3, and end up with 2 (3 -= 1 or 3 = 3 - 1 both equal 2).


  • The next bit checks to see IF a is zero, there is no background for zero so a is reset back to 4. I'll tell you what the next bit means in a minute.


  • Incase a is not equal to zero (which it probably will be in most cases), you have to tell Flash to do something else. The variable a does not need to be reset this time becuase there will always be a background for that number. a will never be greater than 4 becuase it is reset to 4, and never less than zero because it is reset when it gets to zero.


  • Now for the nasty looking bit _root.Back.gotoAndPlay. Remeber that when you dragged the background MC from the library to the main stage, you gave it an instance name of Back? this is why. That name enables Flash to find it and do something with it, in this case gotoAndPlay. _root means the root (or highest) level, the . tells Flash that the next bit belongs to that level (the instance name Back is on the top level) and the second . means a property of the Back instace (this one tells Flash to goto and play the bit in the brackets).


  • What Flash has to goto and play is "BG" add a. The labels in the background MC were BG1, BG2, BG3 and BG4, remeber? Well this actionscript tells Flash to go to BG then the add a tells Flash to stuff whatever is stored in the variable a onto the end. The fancy name for this is Concatenating, but don't worry about that. If the number stored in a was 2, then Flash would end up with the line gotoAndPlay ("BG" add 2) which would be gotoAndPlay ("BG2").


  • The last line textName=name[a] does exactly the same as the array in the Variables layer. It does nothing different, it only refreshes it, like a web browser.

«prev 1 2 3 4 5 next»

» Level Intermediate

Added: : 2001-03-14
Rating: 7.96 Votes: 37
Hits: 10517
» Author
No details available.
» Download
Download the files used in this tutorial.
Download (15 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs