MACROMEDIA FLASH 8-DEVELOPING FLASH LITE Develop Manual page 19

Developing flash lite applications
Hide thumbs Also See for FLASH 8-DEVELOPING FLASH LITE:
Table of Contents

Advertisement

12.
Open the Library and drag an instance of the button named key catcher to the Stage.
Next you'll attach event handler code to this button that handles user keypress events and
update the user interface.
13.
With the button selected on the Stage, open the Actions panel.
14.
Type (or copy and paste) the following code into the Actions panel:
on(keyPress "<Down>") {
if(selectedItem < numItems) {
// Turn off highlight on previously selected menu item:
tellTarget("menu_" add selectedItem) {
gotoAndStop("off");
}
// Increment selectedItem variable
// and turn on highlight for new selection
selectedItem++;
tellTarget("menu_" add selectedItem) {
gotoAndStop("over");
}
// Update status text field with label of selected item:
currentLabel = eval("menu_" add selectedItem add ":label");
status = "Press to select " add currentLabel;
}
}
on(keyPress "<Up>") {
if(selectedItem > 1) {
// Turn off highlight on previously selected item:
tellTarget("menu_" add selectedItem) {
gotoAndStop("off");
}
// Increment selectedItem and turn on highlight for new selection
selectedItem--;
tellTarget("menu_" add selectedItem) {
gotoAndStop("over");
}
// Update status text field with label of selected item:
currentLabel = eval("menu_" add selectedItem add ":label");
status = "Press to select " add currentLabel;
}
}
on(keyPress "<Enter>") {
// Update status field with selected item
status = "You selected " add currentLabel;
}
Handling key events (Flash Professional Only)
19

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-DEVELOPING FLASH LITE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents