Friday, January 23, 2009

FLEX 3 – Basics

 

  • A flex application is delivered as a Flash .SWF file wrapped in html .

Text Controls:

Flex comes with 5 pre-built text controls:
    • Label Control: Presents Single line of text. Used for displaying text. If the text is longer than the width of control, the text is truncated and three dots are added at the end. Change this behavior by adding truncateToFit=false, and the dots will no longer be there. It can display basic HTML tags.
    • Text Control: The text control has word wrapping enabled. Text over multiple lines. It can display basic HTML tags.
    • Text Input: Accepts single line of text.
    • TextArea:  Accepts multiple lines of text.
    • RichTextEdit:

Formatter Classes:

    • CurrencyFormatter
    • DateFormatter
    • NumberFormatter
    • PhoneFormatter
    • ZipCodeFormatter

Image Control

<mx:Image source=”assets/bigben.jpg” />: This downloads the image at runtime. Image is not bundled with the application.

<mx:Image source=”@Embed(‘assets/bigben.jpg’)” />: This embeds the image at compile time. No secondary request to web server. Increases the size of application.

Four kinds of graphics can be loaded dynamically: JPEG,  GIF, PNG, SWF.

Use SWFLoader for showing multiple images.