User Guide
Table Of Contents
- Contents
- Introduction
- Flash Lite Overview
- Hello World Flash Lite application (Flash Professional only)
- Flash Lite authoring features in Flash Professional 8 (Flash Professional only)
- Workflow for authoring Flash Lite applications (Flash Professional only)
- About Flash Lite content types
- Creating a Flash Lite document template (Flash Professional only)
- Tutorial: Creating a Flash Lite Application (Flash Professional Only)
- Cafe application overview (Flash Professional only)
- View the completed application (Flash Professional only)
- Create the application (Flash Professional only)
- Index
Create the application (Flash Professional only) 27
11. Add the following code to handle button events for the menu buttons,
and for selection focus:
// Set initial focus when the application
// starts and also upon returning to the main
// screen from another screen.
if (selectedItem == null) {
Selection.setFocus (specials_btn);
} else {
Selection.setFocus (selectedItem);
}
// Assign onPress event handlers to each menu button,
// and set selectedItem variable to selected button
// object:
specials_btn.onPress = function () {
gotoAndStop ("specials");
selectedItem = this;
};
video_btn.onPress = function () {
gotoAndStop ("video");
selectedItem = this;
};
reservations_btn.onPress = function () {
if (location_so.data.phoneNumber == undefined) {
// User hasn't specified location so
// go to "set location" screen:
gotoAndStop ("options");
}
else {
// Call number in shared object:
var phoneNum = location_so.data.phoneNumber;
getURL ("tel:" + phoneNum);
}
selectedItem = this;
};
The onPress event handlers assigned to the buttons named
specials_btn and video_btn send the playback head to frames
labeled, respectively, “specials” and “video.” You’ll create the content for
those sections later in the tutorial (see “Create the specials screen (Flash
Professional only)” on page 29 and “Create the Video screen (Flash
Professional only)” on page 36).