Things You'll Need:
- Adobe Flash CS4
-
Step 1
Launch Adobe Flash CS4 and select Create New Flash File (Action Script 3.0).
-
Step 2
Rename your layer "actions" by double clicking the layer name in your layers panel.
-
Step 3
Now we start creating our code. Click on frame 1 on the actions layer, then select "Window" from the main menu at the top, and then select "Actions". This will bring up the action script window.
-
Step 4
Type in the code as it is shown in the picture associated with this step. The first line reads stop();. That tells flash to not loop our program when we run it.
The second line:
stage.addEventListener(MouseEvent.CLICK,buttonClickListener);
registers a mouse click event called "buttonClickListener" to the stage. So everytime we click the mouse on the stage the event buttonClickListener will execute. -
Step 5
Now we write the code of our event listener in this case "buttonClickeListener". This function says that when the user clicks the mouse we will print the words "button clicked" in our output window. To see the code you have to look at the associated picture with this step.
-
Step 6
Final ResultsIn the function the parameter "e" can be named anything you want but it must be of type "MouseEvent". We set our return value for our function to "void" since we do not need or expect a return value.
Now run the program by clicking the "CTRL+ENTER" keys on your keyboard, and then start clickin on the stage.














