Flash Tutorials Photoshop Tutorials Flash Games Flash Game Design
Gallery Flash Tutorial  
Part 5) Creating the Image Masks
Step 13.

Line 24: An addBox function is created which will contain all the code involved in adding the individual box MCs to the empty boxes MC, which will be used to mask the top image.

Line 25 - 26: To position the box masks, two FOR loops are needed. One loop is need to position the rows the another is needed to position the columns.

Line 27: With each iteration of the two loops an instance of the box MC is attached to the boxes empty MC we created at the start. Each instance is given the name box plus whatever value depth is. Remember each time an MC is attached we'll be increasing the value of depth by 1. The instance of box is temporaily assigned to a variabled called 'b'. This is so that we can reference is more easily.

Line 28 - 29: Using the temporary variable b, the instance of the box MC has it's dimensions set to the values that were defined earlier.

Line 30 - 31: The box is then is then positioned.

Line 32: The depth is increased for the next MC to be attached on a new level.

 
Step 14.

Line 36: A reset boxes function is created which will be called once the boxes have finished shrinking.

Line 37: Each box mc is looped thorugh

Line 38 - 39: and resized to equal the original box height and width.

 
Step 15.

Line 42: Next the shrink boxes function is created.

Line 43: The shrink variable is checked to see if it's true.

Line 44: If it is a loop is created

Line 45: And the boxes are assigned to 'b'

Line 46: Each box is checked to see if their width is higher then 0.

Line 47 - 48: If it is then it's height and width is reduced by the boxSpeed variable.

Line 50 - 51: The width of the box is also checked to see if it is below 1, in which case we'll no longer need to shrink it, so 'shrink' is set back to false.

Line 52: The boxes are reset

Line 53: The top MC's X position is set to equal newPos, whihc is in turn set when each thumbnail is pressed

Line 54: A break is used to stop the for loop.

Now that the main website is made, go to Flash Gallery - Part 6) Adding the Images & Thumbnails with Actionscript.
Part: 1 | 2 | 3 | 4 | 5 | 6
 
More Flash Tutorials
 
 
 
   
     
     
 
Navigation
Flash Tutorials
Photoshop Tutorials
Flash Games
War Games
 
 
 
 
 
 
 
Top Flash
Create a Spot the Difference Game
Create a Shooter Game
Flash Gallery Tutorial
Flash Website Tutorial
Flash Glitter Graphic
 
 
 
 
 
 
Game Websites
Happy Wheels
Tower Defense Games
Hunting Games
Mario
 
 
 
 
 
 
 
 
     
Site Copyright © 2006 - 2011 Nick DS. All rights reserved.