Developing Flex applications without Flex Builder

Lesson 1 of 99 Quick Flex Lessons

Although Flex Builder makes Flex application development easy, you can survive without it. In this quick lesson, we learn how to build a Flex application using just a text editor and a command line compiler. The lesson sticks with a very easy example, so that you don’t get distratcted by the application complexity.

First we go get the Flex SDK. The lastest version can be accessed from the Flex 3 SDK download page

Next we fireup a text editor. Pick anyone you like. I am currently on the windows platform and I chose something as basic as the notepad for the purpose. We start coding the Flex application by creating the main mxml application file. Let’s call it WithoutFlexBuilder.mxml.

For beginners we include the Application tag and define the Flex framnework XML namespace as follows:

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

Then we add a Label and a Button to this application. We set “Flex without Flex Builder” as the text of the Label and “Yes, It Works without Flex Builder!” as the text of the Button. The application code now looks as follows:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Label text="Flex without Flex Builder" />
<mx:Button label="Yes, It Works!" />
</mx:Application>

When you click the button to confirm that things work without Flex Builder, a Label dispays a message “I am Glad, it does.” Therefore our code is extended to include another Label and a click handler function is defined to set the text of the label as desired.

The final application code is as follows:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
private function clickHanlder(evt:Event):void {
	messageDisplay.text = "I am Glad, it does.";
}
 ]]>
</mx:Script>
<mx:Label text="Flex without Flex Builder" />
<mx:Button label="Yes, It Works!" click="clickHanlder(event)" />
<mx:Label id="messageDisplay" />
</mx:Application>

We save this code as WithoutFlexBuilder.mxml.

Now we need to compile this mxml to a swf file, so that we playback the file in the flash player.

We go to the SDK directory and then traverse down to the bin directory within the SDK directory. The bin directory has a number of executables. One of the executable files called mxmlc is the command line compiler that can compile ActionScript and MXML files to SWF. Configuration and options can be passed to this command line compiler. However, because our case is tivial we do none of that. We simply invoke the mxmlc command and pass our mxml file as its target.

The command then is:

mxmlc C:\workfolder\WithoutFlexBuilder.mxml

The result of this command is the creation of a SWF file with the same name as our MXML file. Finally we open WithoutFlexBuilder.swf using a browser (Firefox in my case). The simple applications looks as shown:

WithoutFlexBuilder

It behaves as desired. That is on pressing the Button it displays the message — “I am Glad, it does.”

Thats it! You have built a simple but complete example without using the Flex Builder. In the next lesson we dig deeper into the command line application compiler and also look at the component compiler.

This entry was posted on Tuesday, July 1st, 2008 and is filed under 99 Quick Flex Lessons, Featured. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Print Posts del.icio.us:Developing Flex applications without Flex Builder digg:Developing Flex applications without Flex Builder spurl:Developing Flex applications without Flex Builder wists:Developing Flex applications without Flex Builder simpy:Developing Flex applications without Flex Builder newsvine:Developing Flex applications without Flex Builder blinklist:Developing Flex applications without Flex Builder furl:Developing Flex applications without Flex Builder reddit:Developing Flex applications without Flex Builder fark:Developing Flex applications without Flex Builder blogmarks:Developing Flex applications without Flex Builder Y!:Developing Flex applications without Flex Builder smarking:Developing Flex applications without Flex Builder magnolia:Developing Flex applications without Flex Builder segnalo:Developing Flex applications without Flex Builder gifttagging:Developing Flex applications without Flex Builder Slashdot Slashdot It! Stumble it!

Leave a Reply

Sponsors

360 Flex Indy

Translator

English flagItalian flagKorean flagChinese (Simplified) flagPortuguese flagGerman flag
French flagSpanish flagJapanese flagArabic flagRussian flagGreek flag
Dutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flag
Hindi flagPolish flagRumanian flagSwedish flagNorwegian flag 
By N2H

Archive

Enhanced Drawing API in Flash Player 10

Discover the possibilities of the new drawing APIs added in Flash Player 10. Learn how to make use of the new vector type to streamline path data and utilize new triangle APIs for creating 3D graphics. Leran to store drawing commands and data inside reusable data objects.

 

Thanks for stopping by!