Flex Framework TextInput with ActionScript
Aim:
We use Label,TextInput and Button components to create Flex Application.
We enter any value into the TextInput, and click the OK button, the entered the value will be display on the Label. This is our problem.
Let’s go to the Flex application.
Procedure:
Step 1:
Open eclipse.
Step 2:
Create TextInput.mxml
Include following coding into TextInput.mxml
< ?xml version = '1.0' encoding = 'utf-8'? >
< mx:Application xmlns:mx = 'http://www.adobe.com/2006/mxml' >
< mx:Script >
< ![CDATA[
private function display(event:Event):void
{
dis.text=disname.text;
}
]] >
< /mx:Script >
< mx:Panel title="TextInput Demo Plus ActionScript"
height="500" width="500"
backgroundColor="Blue" layout="horizontal" >
< mx:Canvas >
< mx:Label text="" id="dis" color="Red" fontSize="25" x="20" y="50"/ >
< mx:TextInput id="disname" x="20" y="100"/ >
< mx:Button label="OK" click="display(event);" x="20" y="150"/ >
< /mx:Canvas >
< /mx:Panel >
< /mx:Application >
Step 3:
Include following coding into build.xml
….
< exec executable='${compiler}' failonerror='true' >
< arg line='-output F:\FLEXWORKSPACE\FlexPro\TextInput.swf' / >
< arg line='F:\FLEXWORKSPACE\FlexPro\TextInput.mxml' / >
< /exec >
….
Step 4:
Run the Application
Already I have explained how to run the flex application using build.xml.
Step 5:
Get output
Go to where you specify to store swf file.
Open TextInput.swf
Ouput
you enter any and click OK
I enter S.Sureshkumar,M.Sc,M.Phil,
you get