Adobe Flash Professional CS6 Adobe Flash Professional CS6 Classroom In A Book | Page 233

Mouse events The following list contains the ActionScript codes for common mouse events for the desktop. Use these codes when you create your listener, and make sure that you pay attention to lowercase and uppercase letters. For most users, the first event ( MouseEvent.CLICK ) will be sufficient for all projects. That event happens when the user presses and releases the mouse button. • • • • • • MouseEvent.CLICK MouseEvent.MOUSE_MOVE MouseEvent.MOUSE_DOWN MouseEvent.MOUSE_UP MouseEvent.MOUSE_OVER MouseEvent.MOUSE_OUT For a complete list of all the events available for a button, check out the Flash Help files and look for the Events of the SimpleButton class. P Note: The void term refers to the data type that is returned by the function. Void means that nothing is returned. Sometimes, after functions are executed, they “return” data, such as doing some calculations and returning an answer. 4 On the next line of the Script pane, type function restaurant1(event:MouseEvent):void { gotoAndStop(10); } The function called restaurant1 contains instructions to go to frame 10 and stop there. The code for your button called gabelloffel_btn is complete. P Note: Be sure to include the final curly bracket for each function, or the code won’t work. 5 On the next line of the Script pane, enter additional code for the remaining three buttons. You can copy and paste lines 2 through 5, and simply change the names of the button, the name of the function (in two places), and the destination frame. The full script should be as follows: stop(); gabelloffel_btn.addEventListener(MouseEvent.CLICK, restaurant1); function restaurant1(event:MouseEvent):void { gotoAndStop(10); } 224 Lesson 6 Creating Interactive navigation