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.
10.10.2006
About Adobe Flex 2
"What about Adobe Flex?", I asked myself few weeks back. When Macromedia was at the helm, Flex was an expensive commercial product and many developers (including myself) stayed away (I mean, the nerve of some companies wanting to actually make money on stuff they produce).
Anyway, as I explore Rich Client options I revisited Flex. Turned out to be a good thing. Adobe has decided to make the Flex SDK free. Meaning you can start creating Flex application as soon as you go through the tons of tutorials and documentations they have online. While the SDK is free, everything elese you have to buy (again, the nerve). If you are a resourceful developer, you should be able to create great application without spending a dime.
As a Java developer, I am interested in client side technologies that work well and are non-intrusive on my backend development. Flex does exactly that. Flex produces Flash client that can communicate with your server using pure HTTP (paid options include SOAP, RCP, JMS, Data Remoting). You write your Flex application in an XML-based dialect that describes components and component layout. Then you compile your code using the SDK's mxmlc compiler which generate the flash file. That is it! I could not believe it was so easy, but it was.
So, keep your interest and skills fresh, go and download Flex and start playing with. In future posts, I will introduce examples specific for the the Java developer so you won't spend hours looking for the feature that does...
Flex Home - http://www.adobe.com/products/flex/
Subscribe to Posts [Atom]