Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Through several hands-on tutorials, instructor Todd Perkins shows how to best build dynamic, streamlined sites using Flash CS3 Professional. Learn how to create custom keyboard shortcuts, apply advanced text techniques such as animating scrolling text with custom easing controls, and using advanced animation techniques. Flash CS3 Professional Beyond the Basics covers many challenging features, including adding complex interactivity to a Flash CS3 project and getting Flash content on a phone. Exercise files accompany the tutorials.
Now we'll talk about events and event handlers. Events are things that happen. One example of an event is a mouse click. Another example is when a file finishes downloading or when a song finishes playing. So those are some examples of events and again they're just things that happen. An event handler is a function that responds to the event. For example when a person clicks on a button something happens, the button navigates to a certain frame. Event handler is what controls that functionality, or what block of code runs when a certain event happens.
So let's take a look at writing an event handler function. If you're following along the file I'm working in is called 03_Events.fla in the Chapter 02 folder in the Exercise Files folder. Select the first keyframe of the Actions layer and open the Actions panel using the keyboard shortcut Option+F9 on the Mac or F9 on the PC. In the Actions panel, define a function. Let's say this function is running when a person's mouse clicks a certain button. So I'm going to call this buttonClicked with capital C. That's the name of the function.
It's going to received a value. I'm going to give the name of the value of event. When an event handler function runs, it receives information about the event that happened. So we need to create a parameter to accept that event. And I'm calling the parameter event here. I'm going to type a colon to declare the data type of the event, and because the event happens with the mouse, it's classified under the data type MouseEvent And again it has a capital M. So MouseEvent, capital E. The returned data type for event handlers is almost always void.
And other than that an event handler looks pretty much just like a function. And there's a look in creating a function that reacts to an event. Now let's make this function do something very simple. So I'll type Trace. Remember a trace statement makes something appear in the output window. And then parentheses after trace, I'm going to type in a value in quotes. The value is going to be "button clicked". So whenever this event handler function runs, the message "button clicked" will appear in the Output window. Now, in order for this function to run we need to connect it to some sort of object and we'll talk about that in the next movie.
There are currently no FAQs about Flash CS3 Professional Beyond the Basics.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.