Graphics Programs Reference
In-Depth Information
be applied to buttons, so they were converted to three-frame movie clips that repre-
sented the up, over, and down states of a button.
The code for the arrow buttons is quite simple. The button variables, next for the clock-
wise rotation, and back for the counterclockwise rotation, are initially set to false. The
onRollOver and onRollOut handlers simply replace the over state of a button. When
the clockwise arrow is pressed, the down state of the movie clip is displayed, next is
set to true, and blank text is placed in the info area of the pop-up window at the bot-
tom of the screen. The counterclockwise arrow is handled in a similar manner.
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// button-related scripts
var back = next = move = false; // initialize the button states
// script for the clockwise turn button
cw_mc.onRollOver = function() {this.gotoAndStop(2);}
cw_mc.onRollOut = function() {this.gotoAndStop(1);}
cw_mc.onPress = function()
{ this.gotoAndStop(3);
next = true;
infoPop_mc.info_mc.gotoAndStop(7);
}
cw_mc.onRelease = cw_mc.onReleaseOutside = function()
{ this.gotoAndStop(1);
next = false;
}
The infoPop_mc movie clip will raise and lower the information area depending on the
status of the toggle variable dropStatus . It is initially set to 1, hiding the panel. When
the user clicks on the ABOUT button, the status changes. If it is a 1, it will be set to 0,
and the panel will be opened. If it is a 0, it will be set to 1, and the panel will be closed.
The audio button has a similar on/off toggle that will play the music or turn it off.
This project can be easily updated by changing the artwork in the assets folder. Flash
can load JPEG, PNG, and other SWF files. As mentioned earlier, it is also easy to use
the project as a template for creating totally different projects. Figure 11.21 shows a
project with an entirely different look and feel, and apart from changing the graphics,
it involved only a few changes in code. Open 03_glassGallery.swf in the Chapter 11
Search WWH ::




Custom Search