Qondio
Front
Intel
IntelMart
Shares
My Qondio
Account
Gordon French > Intel > Flash CS3 Tutorial

qondio.com/mv49 PRINT EMAIL

Flash CS3 Tutorial

Here is a lesson on Creating Event Listeners in Flash CS3 and ActionScript 3.0. Go to www.frenchsquared.com for full tutorials.


Event Listeners
An Event is something that happens, such as a mouse click that Flash can respond to. Events are often things a user does, such as pressing a key or moving the mouse, but events do not have to be user initiated. A function ending or a sound playing can also trigger a response from Flash. Flash and ActionScript needs a way to detect and respond to these events. An event listener or event handler is created to give your object the ability to hear. In basic terms an event lister is something that tells Flash to do this when that happens. Sounds similar to a function, but this event can be user initiated.

ActionScript

Copy and past the example code onto the empty key frame on the actions layer. Remember that objects need to be named. In this tutorial we have already named the circle yourObject_mc.

function onClick (yourObject_mc:MouseEvent):void {
trace("yourObject has been clicked")
};
yourObject_mc.addEventListener (MouseEvent.CLICK, onClick);

Press Control-Enter and Test your Movie.

So first you created a function called onClick you then told Flash that onClick would used with yourObject_mc and a MouseEvent, :Void is the data type tag. You currently set it to Void. Everything inside the {} is the actually action you want to happen, in this case trace "your object has been clicked". The last part is when you actually gave the MovieClip yourObject_mc the ability to hear. You added an event listener to yourObject_mc by first defining the name of the object you want the event listener applied to. (yourObject_mc). Next, addEventListner was applied to the named object. Finally, you defined the event listener by filling in the parameters (MouseEvent.Click, onClick).

External Links

Flash Tutorials | Flash tutorial on Squidoo

Contributed by Gordon French on April 24, 2008, at 5:36 PM UTC.

PLEASE VISIT THE CONTRIBUTOR'S WEBSITE
FrenchSquared
Website dedicated to Flash Tutorials
FrenchSquared.com

Reactions

No reactions yet.

Rate This Intel

Please login or sign up to rate this intel.

Comments

Please login or sign up to add a comment.

Share

Copyright Notice

The copyright for this content entitled "Flash CS3 Tutorial " has been specified by the contributor as:

All Rights Reserved

This content may not be copied, distributed or adapted by anyone under any circumstances.

Login Here with
Any Email Address
Any Password
No account? Sign up.

Intel Contributor
This intel was contributed by Gordon French


Gordon French

Qondio Archive
May, 2012
123456
78910111213
14151617181920
21222324252627
28293031


2008
January, February, March, April, May, June, July, August, September, October, November, December
2009
January, February, March, April, May, June, July, August, September, October, November, December
2010
January, February, March, April, May, June, July, August, September, October, November, December
2011
January, February, March, April, May, June, July, August, September, October, November, December
2012
January, February, March, April, May

Sign Up
Not a member yet? Qondio is a powerful network for making it online. If you have a website to promote, we can help. Sign up and get in on the action.

About Qondio
Welcome to Qondio! Discover the awesome power this network can deliver by going to our About page. Or you could skip straight to the Sign Up form.

ABOUT
SUCCESS GUIDE
FEATURES
FAQ
ADVERTISE
CONTACT
USAGE POLICY
PRIVACY POLICY


TWITTER
FACEBOOK