
TUTORIALS POINT
Simply Easy Learning Page 29
Create a project with a name HelloWorld under a package com.tutorialspoint.client as explained in
the Flex - Create Application chapter.
Modify HelloWorld.mxml as explained below. Keep rest of the files unchanged.
Compile and run the application to make sure business logic is working as per the requirements.
Following is the content of the modified mxml file src/com.tutorialspoint/HelloWorld.mxml.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%" height="100%" minWidth="500" minHeight="500"
initialize="reportEvent(event)"
preinitialize="reportEvent(event)"
creationComplete="reportEvent(event)"
applicationComplete="reportEvent(event)">
<fx:Style source="/com/tutorialspoint/client/Style.css"/>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
[Bindable]
private var report:String = "";
private function reportEvent(event:FlexEvent):void{
report += "\n" + (event.type + " event occured at: "
+ getTimer() + " ms" + "\n");
}
]]>
</fx:Script>
<s:BorderContainer width="500" height="500" id="mainContainer"
styleName="container">
<s:VGroup width="100%" height="100%" gap="50"
horizontalAlign="center" verticalAlign="middle">
<s:Label textAlign="center" width="100%" id="lblHeader"
fontSize="40" color="0x777777" styleName="heading"
text="Life Cycle Events Demonstration"/>
<s:TextArea id="reportText" text="{report}" editable="false"
width="300" height="200">
</s:TextArea>
</s:VGroup>
</s:BorderContainer>
</s:Application>
Once you are ready with all the changes done, let us compile and run the application in normal mode as we did
in Flex - Create Application chapter. If everything is fine with your application, this will produce following result:
[ Try it online ]
Comentários a estes Manuais