In the current tutorial you will come to know about the LinkButton control of Flex. The Adobe LinkButton in Flex is much like the hyperlink option of HTML. It helps us to open a URL in a web browser.
LinkButton in Adobe Flex:
The LinkButton in Flex is much like the hyperlink option of HTML. It helps us to open a URL in a web browser. <mx:LinkButton> tag is used to define this control.
We can put an id to this component if we intend to refer this control elsewhere in the current MXML file or ActionScript file. Whenever we move the mouse pointer over the button the color of the button changes. Following examples will help you to learn LinkButton in details:
Flex LinkButton Example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
public function textarea():void{
txtarea.text="Hello";
}
]]>
</mx:Script>
<mx:Panel width="200" height="200" title="LinkButton Example" horizontalCenter="10" verticalCenter="10">
<mx:VBox horizontalAlign="center" width="100%" height="100%">
<mx:LinkButton label="Click Me" click="textarea();"/>
<mx:TextArea id="txtarea"/>
</mx:VBox>
</mx:Panel>
</mx:Application>
Output:
Example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.formatters.DateFormatter;
import mx.controls.Alert;
public var dateForm:DateFormatter;
public var date:Date;
public var dispDate:String;
public function textarea():void{
dateForm=new DateFormatter();
date=new Date();
dispDate=dateForm.format(date);
Alert.show(dispDate);
}
]]>
</mx:Script>
<mx:Panel width="200" height="200" title="LinkButton Example" horizontalCenter="10" verticalCenter="10">
<mx:VBox horizontalAlign="center" width="100%" height="100%">
<mx:LinkButton label="Click Me" click="textarea();"/>
</mx:VBox>
</mx:Panel>
</mx:Application>
Output: