3 Replies Latest reply on Apr 29, 2009 2:38 AM by ATIF FAROOQ

    execute some method once an effect has been played

    maheshrox

      Hi everybody, I want to execute a method after the effect i have played is finished. is there any property in AnimationProperty tag to acheive it.

       

      In the component i have pasted below, getting data from xml file and using repeater populate those data in Hbox then it moves the horizontal scroll position of HBox using animation property. once animation property has been played, it has to execute some method. how can we do it ?

       

      the next question is

       

      i want to play animation propery infinite times and i have done it with the help of repeatCount but it takes some delay in between. how can it play infinite imes without any delay in between.

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="getXML.send(),slide(event)" >
      <mx:Script>
              <![CDATA[
                  import mx.containers.Canvas;
                  import mx.rpc.events.FaultEvent;
                  import mx.rpc.events.ResultEvent;
                  import mx.effects.easing.*;
                  import mx.controls.*;
                 
                  import mx.collections.*;
                 
                  [Bindable] public static var refThumb : Thumbnail;
                 
                  [Bindable] public var xmlData : XMLListCollection = new XMLListCollection();
                 
                  [Bindable] public var xml :XMLList;
                 
                 
                 
                  public function resultHandler(event :ResultEvent) : void
                  {
                      xml = event.result.product as XMLList;
                     
                  }
                 
                  public function faultHandler(event :FaultEvent):void
                  {
                     
                  }
                 

       

              public function slide(event :Event):void{
                 
                 ap.play();
                  
       
              }
                    
          ]]>
      </mx:Script >
         
        
         
          <mx:AnimateProperty id="ap" effectEnd="{Web.refWeb.nextSlider()}" repeatCount="0" property="horizontalScrollPosition" fromValue="0" target="{can}" toValue="7200" duration="72000" startDelay="0"/>
         
          <mx:HTTPService id="getXML" showBusyCursor="true" url="catalog.xml" resultFormat="e4x" result="resultHandler(event)" fault="faultHandler(event)" />
         
          <mx:HBox paddingTop="20" id="can" width="600" height="200" backgroundColor="white" horizontalScrollPolicy="off" verticalScrollPolicy="off" backgroundAlpha="0.2"  >
         
          <mx:Repeater id="rep" dataProvider="{xml}" >
             
              <mx:VBox id="comp" horizontalAlign="center" horizontalGap="200" width="200" height="200" verticalScrollPolicy="off" horizontalScrollPolicy="off">
          
                               <mx:Image source="{rep.currentItem.image}" width="150" height="100" maintainAspectRatio="false" />
                               <mx:Text text="{rep.currentItem.name}" fontWeight="bold" />
                               <mx:Text text="{'$ '+ rep.currentItem.price}" fontWeight="bold" />
                               <mx:LinkButton label="Add cart" color="blue" />
                              
               </mx:VBox>
             
          </mx:Repeater>
                     
          </mx:HBox>
         
         
         
      </mx:VBox>