Saturday, October 10, 2009

Introduction to Flex

What is Flex?

It is a powerful markup language, can be combined with ActionScript to design RIA

Important features of Flex :

Controls :

TextInput:
<mx:textinput id="searchTxt"></mx:textinput>

Combo Box:
<mx:ComboBox x="53" y="479" id="lstTheme" selectedIndex="1" editable="false" enabled="true">
<mx:ArrayCollection>
<mx:Object label="Toys"/>
<mx:Object label="SunFlower"/>
<mx:Object label="Alphabet"/>
</mx:ArrayCollection>
</mx:ComboBox>

TileList:
<mx:TileList width="200" height="491"
dataProvider="{imageFeed}"
itemRenderer="FlickrThumbnail" x="522" y="10" itemClick="saveItem(event)">
</mx:TileList>
It displays data as a small tiles. dataProvider serves as a input. It can read data from a ArrayCollection.

Tree:
<mx:Tree id="tree" dataProvider="{xml}"
labelFunction="tree_labelFunc"
showRoot="false"
width="250"
height="100%"
itemClick="tree_itemClick(event);">
</mx:Tree>

The above code displays tree, reads the data from xml and relies on tree_labelFunc and tree_itemClick functions for labeling the tree nodes and take action when a user clicks on a tree node respectively.

Code for example 1 (ImageViewer)

Code for example 2 (TreeDemo) (stuff.xml)

Screen-shot 1 or Live Demo

Screen-shot 2 or Live Demo

No comments: