Posts Tagged events

ActionScript 3 and Events

I originally thought that dispatching events in ActionScript 3 would be more complicated than in ActionScript 2. But I was wrong, I wasn’t very complicated to dispatch events in ActionScript 2, well, it’s even less complicated to do so in ActionScript 3. The thing is that version 3 of ActionScript is built around the event model. Another interesting thing is that usually your class that you’d want to dispatch an event from would have to extend EventDispatcher in order to do so, but if this class already extends Sprite or MovieClip you don’t have to extend EventDispatcher; Sprite and MovieClip are already descendant of the EventDispatcher class.  What this means is that you can call the dispatchEvent method from inside a Sprite or MovieClip extending class with no other code to write.

What is a bit more complicated is when you want to create a custom event. It’s not really harder but the thing you have to know is that you have to override the clone and toString method. Once you’ve done that you’re ready to dispatch your own events. I’ll post an example about that soon.

, ,

No Comments

Parse error: syntax error, unexpected ';' in /homepages/25/d169645162/htdocs/wp-content/themes/fusion/footer.php on line 13