Graphics Programs Reference
In-Depth Information
The actions layer contains a simple command— #include "pano.as" . The script that
controls the interactivity is contained in a separate ActionScript file. This allows the
code to be reused by other files. For this project, each panoramic Flash file loads this
ActionScript file to complete the interactivity.
Open pano.as and look at the code. First, we initialize the variables that will be used.
9
10
11
12
13
14
15
16
17
18
19
20
21
// define the panorama display area
imageWidth = 580;
imageHeight = 228;
// define the horizontal & vertical pano limits
maxX = pano_mc._width/2;
minX = imageWidth - maxX; // minX = Stage.width - maxX;
maxY = pano_mc._height/2;
minY = imageHeight - maxY; // minY = Stage.height - maxY;
// define the movement defaults
speedFactor = 20; // lower numbers give faster speeds
pressed = false;
Next, we define the external events that trigger the panoramic movement.
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// define the panorama event handlers
pano_mc.onPress = function() {
pressed = true;
xStart = _xmouse; // store the initial
yStart = _ymouse; / / mouse location
Mouse.hide();
currentx = pano_mc._x; // store the current horizontal
// location of the panorama
};
pano_mc.onRelease = pano_mc.onReleaseOutside = function() {
pressed = false;
Mouse.show();
};
Search WWH ::




Custom Search