<< Chapter < Page Chapter >> Page >

Supplemental material

I recommend that you also study the other lessons in my extensive collection of online programming tutorials. You will find a consolidated index at www.DickBaldwin.com .

General background information

According to Using Behaviors ,

"Behaviors let you add animation and motion to your application in response to user or programmatic action. For example, you can use behaviorsto cause a dialog box to bounce slightly when it receives focus, or to slowly fade in when it becomes visible."

You program behaviors into your applications using MXML, ActionScript, triggers, and effects.

According to About behaviors ,

"A behavior is a combination of a trigger paired with an effect. A trigger is an action, such as a mouse click on a component, a componentgetting focus, or a component becoming visible. An effect is a visible or audible change to the target component that occurs over a period of time,measured in milliseconds. Examples of effects are fading, resizing, or moving a component."

Triggers are not events

Triggers are caused by events, but triggers are different from events. For example, the trigger named mouseDownEffect results from the occurrence of a mouseDown event.

If an Effect object, such as a Glow effect has been associated with a mouseDownEffect trigger for a given target component, the Glow effect will be played when the user presses the mouse button while the mouse pointer is over the target component.This will be true regardless of whether or not a mouseDown event listener is registered on the component.

Thirteen standard triggers in Flex Builder 3

The UIComponent class lists thirteen triggers :

  • addedEffect - Triggering Event:added. Played when the component is added as a child to a Container.
  • creationCompleteEffect - Triggering Event:creationComplete Played when the component is created.
  • focusInEffect - Triggering Event:focusIn Played when the component gains keyboard focus.
  • focusOutEffect - Triggering Event:focusOut Played when the component loses keyboard focus.
  • hideEffect - Triggering Event:hide Played when the component becomes invisible.
  • mouseDownEffect - Triggering Event:mouseDown Played when the user presses the mouse button while over the component.
  • mouseUpEffect - Triggering Event:mouseUp Played when the user releases the mouse button while over the component.
  • moveEffect - Triggering Event:move Played when the component is moved.
  • removedEffect - Triggering Event:removed Played when the component is removed from a Container.
  • resizeEffect - Triggering Event:resize Played when the component is resized.
  • rollOutEffect - Triggering Event:rollOut Played when the user rolls the mouse so it is no longer over the component.
  • rollOverEffect - Triggering Event:rollOver Played when the user rolls the mouse over the component.
  • showEffect - Triggering Event:show Played when the component becomes visible.

Effects are subclasses of the Effect class

Effects are subclasses of the Effect class a couple of levels down the inheritance hierarchy. Flex Builder 3provides a number of built-in effects including the following:

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with actionscript. OpenStax CNX. Jun 04, 2010 Download for free at http://cnx.org/content/col11202/1.19
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with actionscript' conversation and receive update notifications?

Ask