• Home
  • About
  • Contact Us
  • Gallery
  • Video
  • Archives
  • Site Map
Grab the RSS feed

FlashBannerOnline

FlashBannerOnline
  • Home
  • FlashBannerOnline
  • Free Downloads
  • General
  • Tutorials
    • Adobe AIR
    • CSS
    • Fireworks
    • Flash
      • ActionScript
    • FLEX
    • Javascript
      • JQuery
      • MooTools
    • PHP

Events and Event Types in AS3

  • ActionScript, Flash, Tutorials

    Posted on October 24th, 2009

    Written by Behrouz Pooladrag

    Related Posts

    • Render Event in AS3
    • EventDispatcher in AS3
    • Flash Optimization – Activate & Deactivate Events

    Tags

    3 types of events in flash, actionscript, actionscript 3 @eventtype, actionscript @eventtype, adobe flash as3 event type, AS3, as3 detect event type, as3 enterframe events, as3 event type, as3 event types, as3 event typing, as3 generalevent types, as3 trace event types, as3 [event(name="" type="")], different types of events in flash, Event, event datatypes flash, event flash banners, event types as3, event types flash, event types in flash, event.type as3, event.type in as3, eventdispatcher in actionscript, events available in as3, flash as3 event.type, flash as3 of type, flash banners portal type as3, flash detect event type, flash event types, flash.events.event types description, main types of events in flash, mouse event enter frame as3, MouseEvent, mouseevent enter frame as3, ns.play, types of event handler of flash, types of events as3, types of events in as3 pdf, what are the different types of events in flash as3
    Events and Event Types in AS3
    Event objects used with EventDispatcher in ActionScript 3 are a little less generic than those used with ActionScript 2. In AS 3, each event object has its own class. The most common event classes are Event (flash.events.Event) for general events and MouseEvent (flash.events.MouseEvent) for events associated with the mouse. Other event classes can be found in the flash.events package, all of which inherit from Event.

    When using EventDispatcher.dispatchEvent(), you pass in an Event instance that is specific to the event being dispatched. The type of event dispatched is defined within the Event instance used. For example, dispatching an “enterFrame” event would mean using dispatchEvent with an Event instance instantiated with the type “enterFrame”.

    dispatchEvent(new Event(“enterFrame”));

    When an event handler is executed as a result of this event, that event object is passed into the function as a single argument. Properties from that event can then be extracted to learn more about the event that occured. For example, the type property from the Event class tells which event was dispatched.

    addEventListener(“enterFrame”, eventHandler);
    dispatchEvent(new Event(“enterFrame”));
    …
    private function eventHandler(event:Event):void {
    trace(event.type); // “enterFrame”
    }

    Though event types are strings, all common Flash events are available in Flash through static constants of the Event classes. The “enterFrame” event type, for example, is accessible using Event.ENTER_FRAME. Mouse events are within the MouseEvent class. Click events, for example, are MouseEvent.CLICK. These constants are prefered over their string representations.

    addEventListener(Event.ENTER_FRAME, eventHandler);
    dispatchEvent(new Event(Event.ENTER_FRAME));

    When making your custom Events, you can use the Event object with a custom type or alternatively, extend the Event class creating a new kind of Event instance to be used with your events.

    This entry was posted on Saturday, October 24th, 2009 at 8:03 am and is filed under ActionScript, Flash, Tutorials. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

    You might also like

    EventDispatcher in AS3 ActionScript 3 uses the EventDispatcher (flash.events.EventDispatcher) class for all event handling. This class...
    describeType in AS3 that's beautiful.. so much better than typeof.. Though I might also add (if I may), if you want some extremely...
    Flash Optimization – Activate & Deactivate Events Flash optimization is becoming increasing important & with alternative development tools that developers...
    Render Event in AS3 ActionScript has long since relied on the enterFrame (onEnterFrame) event for time-based actions, especially animation...
  • 0 Comments

    Take a look at some of the responses we've had to this article.

  • Post a Comment

    Let us know what you thought.

  • Name:

    Email (required):

    Website:

    Message:

  • Ad Ad

  • FlashBannerOnline.Com

  • Subscribe

    Enter your email address:

    | More

  • Blogroll
    • Random Flash Banner!
  • Tag Cloud

    • actionscript addChild addEventListener Adobe AIR Air Animation AS2 AS3 as3 preloader Banner beginFill BitmapData blog.flashbanneronline.com Class CSS Date Class draw Flash flash.net.URLLoader flash banner free flash banner generator flash banner happy new year flashbanneronline FlashBannerOnline.com flash banner online free flash player function game getChildIndex Javascript lightbox Loading Mysql new year flash banner Object Optimization package PHP Sprite tot Tweener URLLoader URLRequest web XML
  • Recent Comment
    • Behrouz Pooladrag on Flash Optimization – Freezing And Unfreezing Objects
    • Valerie on Flash Optimization – Freezing And Unfreezing Objects
    • FlashLord on RSS Reader for FlashBannerOnline Blog!
    • Behrouz Pooladrag on Using ActionScript 3.0 with PHP Loading External Variables
    • LUN on Using ActionScript 3.0 with PHP Loading External Variables
  • RSS FlashBannerOnline
    • Happy New Year 2012 & Gift!
    • New Templates Oval Light Added to Flash Banner Online
    • FlashBannerOnline started in Arabic language
    • Happy New Year 2011
    • New Templates Christmas 2011 Added at Christmas!
    • New Templates angel animate Added to Flash Banner Online
    • Added Tow New Preloader (Pro Preloader , Rotate Preloader)
    • Happy New Year , by new Theme (Christmas 2010)
  • Add to Technorati Favorites

    Subscribe
  • Google
    Custom Search

Copyright © 2009 FlashBannerOnline - Powered by Wordpress.

FBO by