2. The following script was added to Frame 1 of the Frame Actions box of the main time line.
//### 1. Variables### var stageWidth = 200; var stageHeight = 145; var halfStageHeight =stageHeight/2; var speed = 0; var scale = 1; var maxScaleFactor = 4; var minScaleFactor = 0.5; var clipWidthNow = 1303.0 var actualClipWidth = 1303.0; var left2Right = false; var right2Left = false; var bigger = false; var smaller = false;
Here we declare a series of variables. The stage width and height are manually declared as there is no explicit method to retrieve these values. The speed and scale variables are initialized to 0 and 1, respectively so that the movie is initially stationary and not being scaled. The max and minScaleFactor set how large and small, respectively the menu can be scaled relative to the original dimensions of the menu movie. The variable clipWidthNow is used to track the current size of the menu, whereas actualClipWidth is the width of the menu movie symbol in pixels. This can be retrieved programmatically but I found that there was a slight discrepancy (0.95 pixels) between the actual value and the programmatically retrieved value. Although the difference is not large it is enough to mess up the alignment of the menu movie clips. The next 4 variables, left2Right, right2Left, bigger and smaller are Boolean values which indicate the direction of movement of the menu movie clip and the scaling and are all initialized to false.
|» Level Intermediate|
Rating: 7 Votes: 52
|No details available.|
|Download the files used in this tutorial.|
|Download (24 kb)|
|More help? Search our boards for quick answers!|