Graphics Programs Reference
In-Depth Information
16
17
18
19
20
21
22
23
24
checkTheMouse = function()
{
cursor_mc._x = _xmouse;
cursor_mc._y = _ymouse;
if (_xmouse < centerX-10) { panLeft() }
else if (_xmouse > centerX+10 ) { panRight() }
else dontPan();
}
Step 15: Update the pan handlers
The rest of our job is to make sure that the correct arrow is displayed when necessary.
This can be done with simple additions to our pan handlers. Add the lines shown below.
panLeft = function()
{
cursor_mc.gotoAndStop(1);
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
pano_mc._x += moveAmount;
if (pano_mc._x > xmax) { pano_mc._x -= pano_mc._width/2 }
}
panRight = function()
{
cursor_mc.gotoAndStop(3);
pano_mc._x -= moveAmount;
if (pano_mc._x < xmin) { pano_mc._x += pano_mc._width/2 }
}
dontPan = function()
{
cursor_mc.gotoAndStop(2);
}
This completes the exercise. Save the movie and test it to make sure that everything
works properly. All should be right with the world, well, at least as far as our cursors
are concerned.
 
Search WWH ::




Custom Search