FLEX
code:
<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” backgroundGradientAlphas=”[1.0, 1.0]” backgroundGradientColors=”[#D5D4CD, #D5D4CD]“>
<mx:Script>
<![CDATA[
private function clicked():void
{
lb3.text="hello"+tex.text;
}
]]>
</mx:Script>
<mx:Label text=”enter ur name” y=”12″>
</mx:Label>
<mx:TextInput x=”105″ y=”10″ id=”tex”>
</mx:TextInput>
<mx:Button click=”clicked()” label=”click me” x=”105″ y=”58″>
</mx:Button>
<mx:Label x=”78″ y=”109″ width=”143″ id=”lb3″>
</mx:Label>
</mx:Application>
<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” backgroundGradientAlphas=”[1.0, 1.0]” backgroundGradientColors=”[#D5D4CD, #D5D4CD]“>
<mx:Script>
<![CDATA[
private function clicked():void
{
lb3.text="hello"+tex.text;
}
]]>
</mx:Script>
<mx:Label text=”enter ur name” y=”12″>
</mx:Label>
<mx:TextInput x=”105″ y=”10″ id=”tex”>
</mx:TextInput>
<mx:Button click=”clicked()” label=”click me” x=”105″ y=”58″>
</mx:Button>
<mx:Label x=”78″ y=”109″ width=”143″ id=”lb3″>
</mx:Label>
</mx:Application>
explanation:
in this i have added a text box , label and button .if u enter ur name in the text box and click the button ur name will be displayed .
Textbox,label and button can be added using the following tag
<mx:controlname>
where control name specifies the control
EVENTHANDLING WITH BUTTON:
u can see the property called click in the button tag which specifies the control event and “clicked()” is the function to handle event.
note that function is written in action script in which the text from the text box is extracted and printed in the label using the code
lb3.text=”hello”+tex.text;
feedback