Overlapping rain...


hi new , keep getting problem of raindrops in movie overlaps every time clip loops, , after 5 loops/plays rain clutters stage and

performance/everything slowing down. how restart rain array animation every replay? hope can me in matter, because have client waiting me resolve this... make myself clear: need rain constant, , not add more , more rain replays go on.

 

here code, rain-template in cs6.

 

// number of symbols add.

const num_symbols:uint = 175;

 

 

var symbolsarray:array = [];

var idx:uint;

var drop:rain;

 

for (idx = 0; idx < num_symbols; idx++) {

    drop = new rain();

    addchild(drop);

    symbolsarray.push(drop);

    // call randominterval() after 0 given ms.

    settimeout(randominterval, int(math.random() * 1000), drop);

}

 

 

function randominterval(target:rain):void {

   

    // set current rain instance's x , y property

          target.x = math.random()* 550-50;

    target.y = -math.random() * 200;

 

          //randomly scale x , y

          var ranscale:number = math.random() * 3;

          target.scalex = ranscale;

           target.scaley = ranscale;

 

          var tween:string;

          // ranscale between 0.0 , 1.0

          if (ranscale < 1) {

                    tween = "slow";

 

          // ranscale between 1.0 , 2.0

          } else if (ranscale < 2) {

                    tween = "medium";

 

          // ranscale between 2.0 , 3.0

          } else  {

                    tween = "fast";

 

 

          }

    //assign tween nested in myclip

          myclip[tween].addtarget(target);

 

hoping solution keep nice , constant played flashbanner ad.

kris

when want remove rain, use:

 

function removef():void{

for(var i:int=symbolsarray.length-1;i>=0;i--){

removechild(symbolsarray[i]);

symbolsarray.splice(i,1);

}

 

or, may want edit symbolsarray removing elements no longer visible on stage.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account