it is not a dynamic loading actually because it loses attraction that way. i am not a hard coder but trying to be so my code may not be the best practice. i have basicly Particles and Dot classes, they do the job. i attached the files also.
Here is the Particles class:package {
import flash.display.Sprite;
import com.greensock.*;
import com.greensock.easing.*;
public class Particles extends Sprite {
private var dots:Vector.<Dot > ;
public function Particles() {
//here i am calling them at the same time. i dont have game concept so i dont know if this cause something.
initParticles();
animateParticles();
}
private function initParticles():void{
var cont:Sprite = new Sprite();
addChild(cont);
cont.x = 50;
cont.y = 100;
dots = new Vector.<Dot>();
var i:uint = 0;
var len:uint = 724 * 2;
var forX:int = 0;
var forY:int = 0;
for (i; i < len; ++i) {
dots[i] = new Dot();
dots[i].alpha = 0;
//dots[i].visible = false;
dots[i].x = 750;
dots[i].y = 100;
if (i % 2 == 1) {
dots[i].x = -25 + forX;
} else {
dots[i].x = 724 - forX;
}
forX++;
cont.addChild(dots[i]);
}
}
private function animateParticles():void{
var i:uint = 0;
var len:uint = 724;
var forX:int = 0;
var forY:int = 0;
var forD:Number = 0;
for(i; i < len; ++i){
TweenMax.to(dots[i], 1, {bezier:[{x:730, y:50}, {x:forX, y:forY}], alpha:1, delay:forD, ease:Cubic.easeInOut});
forX++;
forD += 0.005;
}
var j:uint = len;
forX = 0;
forY = 1;
forD = 0;
for(j; j < len*2; ++j){
TweenMax.to(dots[j], 1, {bezier:[{x:0, y:50}, {x:forX, y:forY}], autoAlpha:1, delay:forD, ease:Cubic.easeInOut});
forX++;
forD += 0.005;
}
}
}
}
here is the Dot classpackage {
import flash.display.Sprite;
public class Dot extends Sprite {
public var spr:Sprite;
public function Dot() {
spr = new Sprite();
spr.graphics.beginFill(0xffffff);
spr.graphics.drawRect(0, 0, 1, 1);
spr.graphics.endFill();
addChild(spr);
}
}
}