Wednesday, October 8, 2008

Hello world Flex application

First download the Flex builder, which is an IDE built on top of Eclipse or you can only download Flex SDK.
If you have only sdk then you can use your favorite text editor like notepad, & type the following code as shown below:

Test.mxml
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>

import mx.controls.Alert;
private function display():void

{

Alert.show(txt.text,"Message",Alert.OK);

}

</mx:Script>

<mx:TextInput id="txt" />
<mx:Button label="Click" click="display()" />

</mx:Application>



Now Flex application contains the combination of
MXML
(
is an XML library-based language in that it has a library of specific tags representing GUI components/controls and follows strictly the rules of XML) &
ActionScript 3.0
(an Object oriendted language like java,c#,javascript in which every thing will be converted into & is used to manipulate GUI components)
Every flex application contains the root element of MXML as tag, & inside it, we can place different tags representing different GUI components like label,textbox,button etc.
Then inside it, we can place the tag containing actionscript codes under script tag.

For compiling (goto to the bin directory of flex sdk & type the following to generate the Test.swf file)

mxmlc.exe Test.mxml

For running the flex application

execute
Test.swf file

No comments: