Web Services
  Home arrow Web Services arrow Page 2 - Getting Started with Flex
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WEB SERVICES

Getting Started with Flex
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2008-06-10

    Table of Contents:
  • Getting Started with Flex
  • Developing a Flex Application
  • Flex in the Real World
  • DataGrid

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Getting Started with Flex - Developing a Flex Application


    (Page 2 of 4 )

    Steps

    The previous section provided an overview of the components supported by Flex. Now let us have a look at the steps that are required to develop an application using Flex. Typically, there are three steps involved in developing a Flex based application. They are:

    1. Create an MXML file.
    2. Calling server-side components.
    3. Compile the application into a SWF file.

    Among these, the first step can be sub-divided into three more steps. Here are the details.

    Create an MXML file

    As stated in the previous section, MXML is used to define the UI layout and the controls. A MXML file will, generally, contain the following:

    • Containers – Containers are rectangular regions of the screen that contain controls and other containers. There can be more than one container in a MXML file.
    • Controls – Controls are form elements. They include button, labels, etc.

    To create a MXML file, the steps are as follows.

    Declaring the root container: The root container is the application container. It represents the entire Flash player’s drawing surface. If XML terminology is used, the application container can be called the root element of the MXML document. The following statement declares an application container:


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

    </mx:Application>


    Declaring layout containers is an optional step. The layout containers provide help in laying out the controls. VBox and HBox are the commonly used containers. VBox is used to lay out the controls vertically and HBox lays out components horizontally. For example, the following statement will lay out the controls horizontally. These containers are also known as constraints-based containers.

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

    <mx:HBox x="0" y="0" width="100%" height="100%" id="bodyBox">
    </mx:HBox>

    </mx:Application>

    In the above example, the HBox tag has the attributes x, y, width, and height, which represent the constraints.

    Adding the form controls: The form controls are used to either collect data or display the result of a process. More than one control can be added to a container. For example, the following statements add two text areas to the existing container.  

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

    <mx:HBox x="0" y="0" width="100%" height="100%" id="bodyBox">
    <mx:TextArea id="myText" text="" width="150"/>

    <mx:TextArea id="myText1" text="" width="150"/>

    </mx:HBox>

    </mx:Application>

    Calling server-side components

    A Flex application needs to call the server-side components or services to do the processing on the data gathered or the data to be displayed. To do so, one can add a web service or HTTP service. The only condition is that the service should return either a Java object or XML as a response. For example, to access a server-side component that returns an object, one can use the HTTPService tag. The following statement does the same:


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

    <mx:HTTPService id=”httpService”
    url=”http://localhost/message.php”/>

    <mx:HBox x="0" y="0" width="100%" height="100%" id="bodyBox">
    <mx:TextArea id="myText" text="" width="150"/>

    <mx:TextArea id="myText1" text="" width="150"/>

    </mx:HBox>

    </mx:Application>

    There will be more about processing the response in the future.

    Compile the Application into a SWF file

    To deploy a Flex application, the MXML file needs to be compiled to a SWF file. To compile an MXML file, a tool named mxmlc needs to be used. The following command compiles a MXML file named first.mxml


    mxmlc first.mxml


    That completes the basic steps for creating a Flex application. Next, let us look at a real world application that follows these steps.

    More Web Services Articles
    More By A.P.Rajshekhar


       · excellent article, I was newbie to this technology, by going through the tutorial, I...
     

    WEB SERVICES ARTICLES

    - Safety, Idempotence, and the Resource-Orient...
    - The Resource-Oriented Architecture in Action
    - Features of the Resource-Oriented Architectu...
    - The Resource-Oriented Architecture
    - Getting Started with Flex
    - Automated Billing and Faxing for the Web
    - An Introduction to Web Services
    - The Foundations of Web Services: From Novice...
    - Web Services Reengineering: Finishing Touches
    - Fault Handling with Web Services
    - Flow and Web Services
    - Process Lifecycles and Web Services
    - Business Processes and Web Services
    - Orchestrating Web Services
    - Notifications and Resources in the WS-Resour...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek