Thursday, July 2, 2009

X is for XML in ActionScript

ActionScript's powerful XML support is based on E4X. E4X stands for ECMAScript for XML and is a Document Object Model (DOM) interface for XML. E4X makes XML a first-class citizen in ActionScript.

Learn more about ActionScript XML in Flex at Flex After Dark...

Wednesday, June 24, 2009

V is for Validators

The data that a user enters in a user interface control might or might not be appropriate for the application. In Adobe Flex applications, you use a validator to ensure the values in the fields of a form meet certain criteria. For example, you can use a validator to ensure that a user enters a valid phone number value, to ensure that a String value is longer than a set minimum length, or ensure that a ZIP code field contains the correct number of digits.

Included Validators in the mx.validators package:

  • StringValidator - validates input as a string
  • RegExpValidator - validates input against a regular expression
  • NumberValiator - validates input is a number
  • EmailValidator - validates input is in valid email address format
  • Date Validator - validates input is in valid date format
  • ZipCodeValidator - validates input is in zip code format
  • CurrencyValidator - validates input is a valid currency expression
  • PhoneNumberValidator - validates input is in valid phone number format
  • CreditCardValidator - validates input is in valid credit card format
Learn more about Flex Validators at Flex After Dark...

Thursday, June 11, 2009

T is for Timer

The Timer is a utility class in the flash.utils package. A timer's job is to fire off events at specified intervals.

The below ActionScript shows how to create a Timer instance and start it.

   import flash.utils.Timer;
import flash.events.TimerEvent;

// create a timer which fires every second (1000 ms)
var timer:Timer = new Timer( 1000 );

// add a listener to the timer
timer.addEventListener( TimerEvent.TIMER, handleTimerEvent );

// start the timer
timer.start();

Learn more about the ActionScript Timer at Flex After Dark...

Tuesday, June 2, 2009

S is for Styles

You modify the appearance of Flex components through style properties. These properties can define the size of a font used in a Label control, or the background color used in the Tree control.

Styles in Flex are a lot like CSS (which can be helpful), but not exactly the same (which can be confusing). Some style properties also support Cascading Style Sheet (CSS) inheritance. CSS inheritance means that if you set the value of a style property on a parent container, a child of that container inherits the value of the property when your application runs.

Learn more about Styles and Stylesheets in Flex at Flex After Dark...

Thursday, May 21, 2009

R is for RPC

Flex's RPC package (mx.rpc) defines services for making asynchronous calls to remote services.

Types of RPC services:

  • HTTP - make HTTP calls to web servers
  • Web Services - call SOAP + WSDL based web-services
  • Remoting - call remote object servers such as ColdFusion or Java using BlazeDS
Learn more about Flex Remoting (RPC) at Flex After Dark...

Thursday, May 7, 2009

P is for Projects in Flex Builder

There are several types of projects that can be created via Flex Builder:
  • Flex Web project - create .swf files that run in Flash Player
  • Flex Desktop project - create .air files that run in Adobe AIR-Runtime
  • Flex Library project - create .swc library files for use in other Flex projects
Learn more about Projects in Flex Builder at Flex After Dark...

Thursday, April 30, 2009

O is for Object Oriented ActionScript

ActionScript is powerful, object oriented programming language. ActionScript and MXML are the languages of Flex.

ActionScript requires classes/interfaces to be declared in a package and the explicit import of used classes/interfaces that are not in the same package.

package packageName
{
import another.packageName.*;

public class ClassName extends SuperClassName implements InterfaceName
{
public ClassName()
{
// constructor
}
}
}

Learn more about Object Oriented ActionScript at Flex After Dark...

Monday, April 27, 2009

N is for Namespaces in MXML

If you want to use custom components (outside of the mx or flash packages) in your Flex application, first you'll have to setup a namespace to tell Flex where to find your custom controls. (Using custom controls in your MXML can be a little tricky at first.)


xmlns:mycontrols="my.custom.controls.*"
>


Learn more about MXML Namespaces at Flex After Dark...

Monday, April 20, 2009

M is for Menus

The Flex Menu control creates pop-up menus of individually selectable choices, that can have cascading sub-menus. (Similar to the application menus (e.g. File, Edit) or right-click menus in most application.)

A Menu is created with a call to the Menu class static createMenu() function. Of course you'll have to pass some data representing the menu items and structure to the createMenu() call.

   // create the menu data structure
var menuData:Array = [ "Item 1", "Item 2", "Item 3" ];

// create the menu
var menu:Menu = Menu.createMenu( parent, menuData, false );

// show the menu
menu.show()

Learn more about Menus in Flex at Flex After Dark...

Tuesday, April 14, 2009

L is for Libraries

A Library is collection of Flex/ActionScript classes and resources compiled to a .swc file.

A library is different than a Flex application in that you cannot launch a library. Rather, a library is a code reuse and packaging mechanism.

Learn more about Flex libraries at Flex After Dark...