Tutorial Button in Flex will illustrate various features of Button, A Button is usually in rectangular shape and it looks like it can be pressed, it could have a text, an icon, or both.A Button could be a normal button or toggle button. A normal button persists in deselected mode after clicking, but in the case of toggle button it has two states selected and deselected. Example will helps you to learn it more preciesely.
Tutorial Button in Flex will illustrate various features of Button, A Button is usually in rectangular shape and it looks like it can be pressed, it could have a text, an icon, or both.A Button could be a normal button or toggle button. A normal button persists in deselected mode after clicking, but in the case of toggle button it has two states selected and deselected. Example will helps you to learn it more preciesely.Button:
A Button is usually in rectangular shape and it looks like it can be pressed, it could have a text, an icon, or both.
A Button could be a normal button or toggle button. A normal button persists in deselected mode after clicking, but in the case of toggle button it has two states selected and deselected.
Buttons typically use event listeners to perform various tasks. When a user click a button either by mouse pointer or using the keyboard, it dispatches a click event. A button dispatches various events like mouseMove, mouseOver, mouseOut etc.
Following example shows a Button control:
Example:::::::strong>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
public function dispMsg(event):void{
btnTxt.text+=" "+event.target.label+" is clicked"+'\n';
}
]]>
</mx:Script>
<mx:Panel width="400" height="200" title="Button click Events">
<mx:HDividedBox height="100%" width="100%">
<mx:VBox>
<mx:Button click="dispMsg(event);" label="First Button" id="fst"/>
<mx:Button click="dispMsg(event);" label="Second Button" width="{fst.width}"/>
<mx:Button click="dispMsg(event);" label="Third Button" toggle="true" selected="true"/>
</mx:VBox>
<mx:TextArea id="btnTxt" width="50%" height="100%"/>
</mx:HDividedBox>
</mx:Panel>
</mx:Application>
Output: