Setting Triggers With ActionScript : ActionScript « Development « Flex






Setting Triggers With ActionScript

Setting Triggers With ActionScript
          
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
  <mx:Script>
    
      import mx.controls.Image;
      import mx.effects.Fade;
      private var myImage:Image = new Image();
      
      private function initApp():void{
        this.addChild(myImage);
        myImage.source = "logo.jpg";
        myImage.x=150;
        myImage.y=100;
        myImage.setStyle("showEffect", new Fade());
        myImage.setStyle("hideEffect", new Fade());
      }
  
  </mx:Script>
  <mx:Button x="150" y="375" label="Show Image" click="myImage.visible=true"/>
  <mx:Button x="374" y="375" label="Hide Image" click="myImage.visible=false"/>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Use ActionScript to configure controlsUse ActionScript to configure controls
2.Applying behaviors in ActionScript with Resize classApplying behaviors in ActionScript with Resize class
3.Set target and targets properties in ActionScriptSet target and targets properties in ActionScript
4.Add controls with ActionScriptAdd controls with ActionScript
5.Load swf file with ModuleManager in ActionScriptLoad swf file with ModuleManager in ActionScript
6.Inline ActionScriptInline ActionScript
7.Set Properties of a Child Defined in MXML in ActionScriptSet Properties of a Child Defined in MXML in ActionScript
8.Bind to Properties by Using ActionScriptBind to Properties by Using ActionScript
9.Specify an id value to refer to a component elsewhere in your MXML, either in another tag or in an ActionScript blockSpecify an id value to refer to a component elsewhere in your MXML, either in another tag or in an ActionScript block
10.Tags Are ClassesTags Are Classes
11.Attributes Are PropertiesAttributes Are Properties