1 Reply Latest reply on May 8, 2011 7:40 PM by Benoitcn

    Animate Class issue

    Benoitcn Level 1
          <fx:Declarations>
               <s:Animate id="animateEffect"
                          target="{targetBox}" repeatCount="2" repeatBehavior="reverse" disableLayout="true" 
                          effectStart="effStart(event)" effectEnd="playButton.enabled=true;">
                   <s:motionPaths>
                     <!-- How can use dynamic value each time before the effect started -->
                     <!-- and I can't find any event before 'effectStart' so I can't change the value before it played -->
                       <s:SimpleMotionPath property="x" valueFrom="0" valueTo="{xPostion()}"/>
                       <s:SimpleMotionPath property="alpha" valueFrom="1" valueTo="0"/>
                   </s:motionPaths>
               </s:Animate>
           </fx:Declarations>
           
           <fx:Script>
               <![CDATA[
                   import mx.effects.AnimateProperty;
                   import mx.events.EffectEvent;
                   [Bindable]private var n:Number;
                   
                   private function xPostion():Number{
                       n = Math.random() * 200;
                       return n;
                   }
                   
                   /* the property affect next time , because the effect start with last value of n */
                   private function effStart(e:EffectEvent):void{
                       playButton.enabled=false;
                       animateEffect.motionPaths[0] = new SimpleMotionPath("x", 0, xPostion());
                   }
               ]]>
           </fx:Script>
      
      
      

       

      Another question does the TweenLite class has the ability giving the value from a function before it played ?