Jump to content
Search Community

Macan_NBGD

Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by Macan_NBGD

  1. Thanx for trying Carl, but still not working. I've made those spelling errors just before posting code here, so that was not real problem, also those "( )" in tweenMax's onComplete didn't solve problem. here's fla file - you'll see that if you comment code in last (removeParticles) function everything will work just fine, so I'm definitelly doing something wrong in that one.. 


    thanx in advance………


    Texteffwct_2.swf.zip

  2. Can anyone pls help me realize what I'm doing wrong here..

    goal is to animate particles into letters, and when finally completed to execute removeParticles function which should remove particles from the stage in a same manner they were added. everything works just fine except that last function (when function removeParticles executes flash player begins that 'not responding' behaviour)..any advice welcome..thanx. here's code:

     

    import flash.display.BitmapData;
     import flash.display.Sprite;
     import flash.display.MovieClip;
     import com.greensock.TweenMax;
     import com.greensock.easing.*;
     import flash.display.Bitmap;
     import flash.events.Event;
     
    [sWF(backgroundColor="0x000000", frameRate="30", width="800", height="200")]
     
         var positions:Array = [];
         var SPACING_Y:uint = 3; 
         var SPACING_X:uint = 3;
    var circlesArray:Array = [];
         var circleRadius:uint = 3;
     
         var container:Sprite;
     
    mapParticles(); 
     
    function mapParticles():void
    {
    container = new Sprite();
    addChild(container);
    var letters:Letters= new Letters();
    container.addChild(letters);
    var bmd:BitmapData = new BitmapData(letters.width, letters.height, false, 0xffffff);
    bmd.draw(letters);
     
       letters.visible = false;
     
    var rows:int = letters.height / SPACING_Y;
    var cols:int = letters.width / SPACING_X;
     
    for(var i:int = 0; i < cols; i++)
     {
      for(var j:int = 0; j < rows; j++)
     {
     
      var pixelValue:uint = bmd.getPixel(i * SPACING_X, j * SPACING_Y);
     
      if(pixelValue.toString(16) != 'ffffff' && pixelValue.toString(16) != '0')
      {
    positions.push({xpos:i * SPACING_X, ypos:j * SPACING_Y });
      }
    }
      } 
     
     
    shuffle(positions);
     
    generateParticles();
    }
      
    function shuffle(arr:Array):void 
    {
    var rand:int;
    for(var i:int= 0; i<arr.lenght; i++)
    {
    var tmp:*= arr[int(i)];
    rand= int(Math.random()* arr.length);
    arr[int(i)]=arr[rand];
    arr[int(rand)]=tmp;
    }
     
    }
      
    function generateParticles():void
    {
    for(var i:int = 0; i < positions.length; i++)
    {
     var circle = new Sprite()
     circle.graphics.beginFill(Math.random()* 0xffffff);
     circle.graphics.drawCircle(0, 0, circleRadius);
     circle.graphics.endFill();
     container.addChild(circle);
     circle.x = Math.random() * stage.stageWidth;
     circle.y = Math.random() * stage.stageHeight;
     circle.alpha = 0; 
     circlesArray.push(circle);
    }
    animateParticles();
    }
     
     
    function animateParticles():void
    {
    for(var i:int = 0; i < circlesArray.length; i++)
    {
     
     TweenMax.too(circlesArray,0.5, {
     x:positions.xpos,
     y:positions.ypos,
     alpha: 1,
     delay:i * 0.01, 
     ease:Back.easeOut,
     easeParams:[3], onComplete:removeParticles()});
      
    }
     
    }
     
    function removeParticles():void
    {
    for(var i:int= 0; i<circlesArray.length; i++)
    {
    TweenMax.to(circlesArray, 1, {
    x:Math.random() * stage.stageWidth, 
    y:Math.random() * stage.stageHeight, 
    alpha:0, 
    delay:i* 0.01, 
    ease:Back.easeIn, 
    easeParams:[1]}); 
    }
     
    }
     

     

  3. can anyone please help me - I'm pretty much newbie in scripting and got problem when trying to reset animated value in textField..goal is to make TextField count numbers from zero to 15, and onComplete reset to zero and count again..( thanks in advance)..here's my code:

    var form:TextFormat= new TextFormat("Arial", 25, 0);
    var fifteen_TF:TextField= new TextField();
    fifteen_TF.defaultTextFormat= form;
    fifteen_TF.x= fifteen_TF.y= 200;
    addChild(fifteen_TF);
    var num:int= 0;
    function moveNums():void
    {
    TweenLite.to(this, 4, {num:15, onUpdate:updateText, onComplete:resetTween, ease:Linear.easeNone});
    }
    function updateText():void
    {
    fifteen_TF.text= String(int(num));
    }
    function resetTween():void
    {
    //fifteen_TF.text= "";
    //updateText();
    }
    moveNums();
    

×
×
  • Create New...