Pages

Friday, 30 March 2012

MXML Vs Action Script

MXML vs ActionScript 3.0

Flex components can be added to an application using MXML or ActionScript 3.0. Both code examples below display the same results.
previous page next page

MXML

Components are implicitly initialized when the user runs the application.

Form Layout in flex

The Form Layout Container

  • The Form container lets you:
    • Control the layout of a form.
    • Mark form fields as required or optional.
    • Handle error messages.
    • Bind your form data to the Flex data model to perform data checking and validation.

Thursday, 29 March 2012

UI Event in Flex(Button click and result handler)

Simple UI Event

Example 1

  • A click event is created by clicking the button
  • The click event triggers the event handler

Event Propagation in Flex

Event Propagation

Terms to know:
  • event.target: The target property refers to the dispatcher of the event
  • event.currentTarget: The currentTarget property refers to the current object that is processing the event

Event Handling in Flex

Event Listeners

Terms to know:
  • eventType: Event type broadcast by the object when an event occurs. This is represented as a String data type.
  • event listener: The function or class method that you write to respond to specific events. They're also known as event handlers.

Validators and Formatters example with Area Code Lookup in flex

Validators

  • Validators can be used to verify that data meets certain criteria on the client before being sent to the server.
  • Validation occurs when the field loses focus
  • Error message is displayed on mouseover
  • Indicate the source and source property, for example, mx:TextInput/text.

External Interface in Flex - Running Javascript in Flex

External Interface

The ExternalInterface class enables  communication between ActionScript and Flash Player containers such as an HTML page containing JavaScript and an embedded SWF file, or an application that has the Flash Player embedded in it. The communication is available in both directions. An HTTP/JavaScript page can call an ActionScript function which can return data that the JavaScript can use or ActionScript can call Javascript.