Change the text of a button whenever you clicked

In the current tutorial we'll study that how to change the label of a button on clicking on itself. You can make a separate actionScript file, but in this tutorial that has been included in a single file.

Change the text of a button whenever you clicked

Change the text of a button whenever you clicked

     

 

In the current tutorial we'll study that how to change the label of a button on clicking on itself. You can make a separate actionScript file, but in this tutorial that has been included in a single file.

 

 

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
<mx:Script>
<![CDATA[
public function changeText():void{
if(First.label=="Change")
First.label="Changed";
else
First.label="Change";
}
]]>
</mx:Script>
<mx:Button id="First" label="Change" click="changeText()"/>

</mx:Application>