Monday, July 19, 2010

Flex Framework using eclipse to run flex


Using Eclipse IDE

Aim:
            Using Eclipse IDE, to develop the Flex technology.

Procedure:
            Step 1:

                        Download Eclipse www.eclipse.org/downloads/


Unzip the Flex sdk_4.1

I have unzipped Flex sdk_4.1 into the

E:\InstalledSoftware\FlexSoftware

            Step 2:

            2.1. Open the Eclipse






























Click ok. The eclipse will open.

2.2. Create Project

            Go File—New—Project
























New Project window will open.























You select General and Project and click Next>

Another New Project window will open. where you give project name such as

FlexProject



















Next> and Finish.

New Project named FlexProject was successfully created.


Step 3:

            Create file named FlexExample

            Right click on FlexProject—New—File—new window will open

            Where you give filename such as FlexExample.mxml.

            Extension is mxml. Don’t forget to give extension mxml.












































click Finish

File FlexExample.mxml have been created successfully.

Include following coding into FlexExample.mxml



< ?xml version = '1.0' encoding = 'ISO-8859-1'? >
< mx:Application xmlns:mx = 'http://www.adobe.com/2006/mxml' >
< mx:Script >

< /mx:Script >
< mx:Panel title = 'Navaladiyan Technology' color = 'green' height="500" width="500" >
< mx:Canvas >

< mx:Label text="UserName" id="username" x="100" y="100" color="Red"/ >
< mx:TextInput id="tusername" x="180" y="100" color="Blue"/ >

< /mx:Canvas >
< /mx:Panel >
< /mx:Application >














Step 4:

Create build.xml

Right click on FlexProject—New—File—new window will open

Where you give filename build.xml (note don’t change the name)

Note:
            Don’t change the name  build.xml.









































open the build.xml

include following coding into build.xml

< project name='Flex' default='mxml' >

< target name='mxml' >
< property name='compiler' location='E:\InstalledSoftware\FlexSoftware\bin\mxmlc.exe' / >
< exec executable='${compiler}' failonerror='true' >
< arg line='-output F:\FLEXWORKSPACE\FlexProject\FlexExample.swf' / >
< arg line='F:\FLEXWORKSPACE\FlexProject\FlexExample.mxml' / >
< /exec >
< echo > mxml file compiled successfully < /echo >
< echo > swf file generated successfully < /echo >
< /target >


< /project >












Note:

< property name='compiler' location='E:\InstalledSoftware\FlexSoftware\bin\mxmlc.exe' / >

You specify the location where you installed the flex mxmlc.

mxmlc is flex compiler which is located in bin directory of the flex.


< arg line='-output F:\FLEXWORKSPACE\FlexProject\FlexExample.swf' / >

where you specify the directory where you have to store swf file.


< arg line='F:\FLEXWORKSPACE\FlexProject\FlexExample.mxml' / >

here you specify the directory where you have stored mxml file.


Step 5:

Run the application

Select build.xml

Right click the inside the build.xml

Select Run As and 1 Ant Build
























Console will open like below









Step 6:

                        Open the flex file in Browser

            Go to the where you have stored the mxml file and swf.

            And select appropriate file I have opened the FlexExample.swf.











Step 7:

Get output




No comments:

Post a Comment