Graphics Programs Reference
In-Depth Information
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
checkTheMouse = function()
{
// set the cursor position to the mouse location
cursor_mc._x = _xmouse;
cursor_mc._y = _ymouse;
xmoveAmount = Math.abs(_xmouse - startX)/speedFactor;
if (_xmouse < startX - 10) { panLeft(); }
else if (_xmouse > startX + 10 ) { panRight(); }
//else dontPan();
ymoveAmount = Math.abs(_ymouse - startY)/speedFactor;
if (_ymouse < startY - 10) { scrollDown(); }
else if (_ymouse > startY + 10 ) { scrollUp(); }
// setCursor();
}
Note the commented lines in the checkTheMouse handler. The first one removes going
to the dontPan() handler. This line can, in fact, be deleted. New cursors will be set in the
setCursor() handler, which we will soon define.
Step 9: Create the panning functions
The functions for panning are provided below. They are the same as previously with the
exception of having removed the lines that set the cursor and changing moveAmount to
xmoveAmount . Modify your script to match that below.
54
55
56
57
58
39
60
61
62
63
64
panLeft = function()
{
pano_mc._x += xmoveAmount;
if (pano_mc._x > xmax) { pano_mc._x -= pano_mc._width/2 }
}
panRight = function()
{
pano_mc._x -= xmoveAmount;
if (pano_mc._x < xmin) { pano_mc._x += pano_mc._width/2 }
}
 
Search WWH ::




Custom Search