Folks,

Thanks for your interest Here we will be explaining the Very Basic Starter of Flex Application. "Hello World!" Application. Follow the below steps to build this App.

//Note:- This Tutorial is based on FLEX 3.
Step 1: Open Flex Software and Create a New Project. File-> New Flex Project.

Step 2: Enter Project Name ex:- "Hello" and Click on Finish button.

Now you can see the hello.mxml with some XML code. This is nothing but basic code to initialize the application. You will have two views "Source View" and "Design View"

Step3: Click on the Source View and copy the below code and replace with the existing code.


// Save this as Greeter.as //

package
{
public class Greeter
{
public function sayHello():String
{
var greeting:String;
greeting = "Hello World!";
return greeting;
}
}
}

Step 4: save it as Greeter.as

Step 5: Overwrite the code from "Helloworld.mxml" in the below zip file into the Newly created page and drag and drop the Greeter.as file into the lib folder of the project.

Step6: Click on Run to see the Output.

Explanation:
-------------
1) In Greeter.as file we are just writing a class to initiate a variable called "greeting" and assigning some value "Hello World!" to it.

2) In the Helloworld.mxml code what we did is, we just created few basic components.
they are

2 text Labels just to write some intro text and 1 text area and we set the text area name to "maintxt" and in runtime we are calling "creationComplete = "initApp()" . This will call the function initApp() once it loads the Flex application. So the value in the variable will appear on the text area.

Conclusion:

Here we have worked with

1) How to create a simple class in Flex and initiate values to the variables
2) Calling simple functions in the MXML Application
3) How to use Text Labels, Text areas.

Hope you like the tutorial. Please download the Sources files for practice. Please send us your comments / questions to help you.

Download Source files

2 comments

  1. Unknown // July 14, 2008 at 3:42 AM  

    Woww, this example is really useful. please post more no. of examples like this.. thank you.

  2. Mr.Antony clerk // December 14, 2008 at 8:55 PM  

    Thanks for this very basic "Hello world".
    The way of approach is very clear and easy. best suit for a beginner.
    This a real hello world example
    Thank you.

    Ajith - Sri lanka