1 Reply Latest reply on Mar 14, 2011 2:29 AM by BhaskerChari

    calling function from actionscript (.as) file for button in mxml

    anandbk Level 1

      Hi Guys,

       

      Can anyone help me in this regard.

       

      I have Actinscript file in which i have defined a function like below:

       

      actionScript.as (file name)

       

      import mx.controls.Alert;

       

      public function abc():void{

           Alert.show("Inside abc(): My Button Clicked");

      }

       

       

      Now i have button in mxml and i am calling above function in my buttion "click" attribute like below.

       

      Importing script in mxml:

       

      <mx:Script source="actionScript.as" />

       

       

      Using function:

       

      <mx:Button id="button1" label="My Button" click="abc()"/>


      Can any one help me, is there any thing else i need to do OR am i going wrong somewhere ?

      Thanks,
      Anand.