Graphics Programs Reference
In-Depth Information
Step 7: Add to ActionScript
Adjust the ActionScript you typed in step 4.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//stop the main timeline
stop();
//record a stopping point for the zooming
stopZoomIn = door5_mc._xscale;
stopZoomOut = door1_mc._xscale;
//zoom on keyPress
_root.onEnterFrame = function()
{
if (Key.isDown(Key.UP)) {
if (door1_mc._xscale < stopZoomIn){
door1_mc._xscale = door1_mc._yscale += .5;
door2_mc._xscale = door2_mc._yscale += 1;
door3_mc._xscale = door3_mc._yscale += 2;
door4_mc._xscale = door4_mc._yscale += 4;
door5_mc._xscale = door5_mc._yscale += 8;
animate = "backward";
}
}
if (Key.isDown(Key.DOWN)) {
if (door1_mc._xscale <> stopZoomOut){
door1_mc._xscale = door1_mc._yscale -= .5;
door2_mc._xscale = door2_mc._yscale -= 1;
door3_mc._xscale = door3_mc._yscale -= 2;
door4_mc._xscale = door4_mc._yscale -= 4;
door5_mc._xscale = door5_mc._yscale -= 8;
animate = "forward";
}else{
animate = "stop";
}
}
}
These additions and changes control the man_mc movie clip instance. A variable called
animate stores the frame label name. Depending on which key the user presses, man_
mc will navigate to the appropriate frame. If no keys are pressed, man_mc navigates
to frame 1, which is labeled stop . How does Flash know that there are no keys being
 
Search WWH ::




Custom Search