| In this tutorial, we will introduce event listeners and event handlers for FlashR and ActionScript 3.0. You will use this code if you want to run a function when an event occurs. For example, a button can work as a link in your Flash site. When you click on the button, that is a mouse event. Therefore, to make the button work with ActionScript, we would need to write code that will listen for the mouse event and then take the visitor to the next page. But, this code can be used for other reason besides button links. In this tutorial, we will draw a star in the center of the stage. Then we will write ActionScript that will listen for a mouse click and rotate the star on the stage.
We need to create an event listener to listen for the mouse click and an event handler to rotate the star movie clip. Let's take a look at the code.
The Event Listener
The first line of code will create an event listener for the mouse click and the star1_mc object.
These two lines of code will create the function or event handler that will rotate the star.
| |||


















