background preloader

ActionScript 3

Facebook Twitter

Introduction to event handling in ActionScript 3.0. Event handling in ActionScript has changed significantly over the past few releases of Flash Player. With the introduction of ActionScript 3.0, this trend continues. Using ActionScript 3.0, you have even more control when working with events. This article covers the new features related to event handling in ActionScript 3.0. You'll learn how the new EventDispatcher class works—especially in relation to using mouse events.

You will also learn about event propagation, event objects, and how to create your own custom events. Event handling in ActionScript 3.0 depends heavily on the EventDispatcher class. Although this class isn't entirely new to ActionScript, it is the first time it has been included as a core part of the ActionScript language. For those not familiar with EventDispatcher, the basic concept is this: First you create functions, or event handlers, to react to various events.

SubmitButton.onPress = function() { ... } delete submitButton.onPress; Where is EventDispatcher? The stage. I help people make Flash games — Michael James Williams. ActionScript 3 Event Listeners Tips & Tricks | Almog Design. Help.adobe.com/en_US/as3/mobile/flashplatform_optimizing_content.pdf. Foundation Flash: - Free Flash/ActionScript Tutorials & Help. Thinkubator – A Thoughtprocess Interactive Blog » Blog Archive » The power and genius of mouseChildren and mouseEnabled. Jan 20 I admit, this post will be useless for most readers of this blog. But if you happen to be an Actionscript programmer… I had a minor epiphany today from which you might benefit. Since I started writing AS3 code, I’ve generally viewed the mouseChildren and mouseEnabled properties of the InteractiveObject class (and by extension the Sprite class) as relatively superfluous. They existed as little more than a recourse for when something accidentally got ‘in between’ the mouse and a button that needed to be pressed.

Fundamentally, these two properties are straightforward. The magic comes by virtue of the fact that these two properties work independently of each other. Sprite ‘flattening’. Given this greater understanding, I almost wonder why the AS3 creators chose to set the default of mouseEnabled to true.