0 Replies Latest reply on Apr 13, 2011 12:32 AM by LLMMM

    Move effect in loop

    LLMMM

      Hoi i'm struggle a long time with this issue.
      i'm trying to create a move effect in a for statement.

       

      example classe component

       

       

      Code:
      public class Circel1 extends UIComponent
           {
          
                public function Circel1()
                {
                     super();
                     createCircle(0xFF0000,5);    
                }
               
                public function createCircle( color:uint, radius:Number):void {
                     _circel = new Shape(  );
                     _circel.graphics.beginFill( color );
                     _circel.graphics.drawCircle( 0, 0, radius );
                     _circel.graphics.endFill();              
                     this.addChild(_circel);
                }

       

      in my mean application i'm making a arraycollection

       

      with from x1 ,y1, to x2, y2

       

      Code:
      <s:Move id="myMove" xFrom="{_x1}" yFrom="{_y1}" xTo="{_x2}" yTo="{_y2}" target="{cr}" />

      for(var i:int=0; i<ArrCoordinator.length;i++)
      {
           _x1=ArrCoordinator.getItemAt(i).x1;
           _y1=ArrCoordinator.getItemAt(i).y1;
           _x2=ArrCoordinator.getItemAt(i).x2;
           _y2=ArrCoordinator.getItemAt(i).y2;
                                   
           if(blNewImage)
           {     cr= new Circel1();
                canvas.addElement(cr);
                myMove.play();
                myMove.addEventListener(EffectEvent.EFFECT_END,
                      function RemoveEle(e:EffectEvent)
                      {
                           if(cr)
                          {
                          //this.canvas.removeChildAt(i);
                          cr =null;
                          blNewImage=false;    
                          }
                     }
                );    
      }

       

      The purpose of my applications is that the move effect plays one by one.

       

      so when the first move effect finish playing, start the other on different x and y coordinations

       

      but what he does is playing all the x and y coordination together.

       

      can somebody help me out of this ... please ??