seemingly random and unorgainzed bits of information
10.13.2006
Getting Started with Flex 2
Download SDK (requires registration)
Unzip SDK to a location of your choice [FLEX_HOME]
Add your FLEX_HOME/bin location to your system's PATH.
Write your code
Compile using mxmlc Flex compiler
Deploy.
Your First Flex – Hello Flex
Open your favorite IDE (TextPad, NotePad, Eclipse, NetBeans, etc).
Create a new text document (must use the .mxml extension when saved)
Type the following:
3. Save file as 'helloflex.mxml'
<mx:Application width="100%" height="100%"
xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center" verticalAlign="middle">
<mx:Script><![CDATA[
import mx.controls.Alert;
]]>
</mx:Script>
<mx:Panel id="panel" title="Hello Flex">
<mx:Form width="100%">
<mx:FormItem label="Enter Name:">
<mx:TextInput id="myName" text=""/>
</mx:FormItem>
</mx:Form>
<mx:ControlBar horizontalAlign="center">
<mx:Button id="btn" label="Say Hello" click="Alert.show('Hello ' + myName.text);"/>
</mx:ControlBar>
</mx:Panel>
</mx:Application>Compile Code to generate swf file
$> mxmlc -file-specs helloflex.mxml
Deploy the Flash file
Open file helloflex.swf in your browser.
The Details
Flex uses a code-compile-deploy model similar to Java development. You write your GUI layout structure using Flex's declarative XML-based language 'MXML'. Flex also uses ActionScript, a true object oriented derivative of ECMAScript (also know as standard JavaScript). When you compile your code, Flex's mxmlc compiler transform the XML file into pure ActionScript then compile it into Flash byte code (.SWF).
Next posts we will look at Flex from a Java developer's perspective.