Código :
this.shapeX=new Number this.shapeY=new Number
pero continua igual, no se que puede estar mal
¿Alguien lo sabe?
Código :
fly = function () {
this.shapeX=new Number
this.shapeY=new Number
this._xscale = 30;
this._yscale = 30;
this.shapeX = this._x;
this.shapeY = this._y;
this.targetX = 0;
this.targetY = 0;
this.oldTargetX = 0;
this.flockX = (Math.random()*200)-100;
this.flockY = (Math.random()*200)-100;
// Crear el script onEnterFrame para animar _parent
this.onEnterFrame = function() {
// posicion del raton y distancia de este
this.targetX = _root._xmouse;
this.targetY = _root._ymouse;
this.distX = this.targetX-this.shapeX+this.flockX;
this.distY = this.targetY-this.shapeY+this.flockY;
if ((this.targetX == this.oldTargetX) && Math.random()>0.9) {
// si el raton esta quieto el grupo se hace mas compacto
this.flockX = (Math.random()*200)-50;
this.flockY = (Math.random()*200)-50;
} else if ((this.targetX != this.oldTargetX) && Math.random()>0.8) {
// Si el raton esta quieto la nube ocupa mayor espacio
this.flockX = (Math.random()*400)-200;
this.flockY = (Math.random()*400)-200;
}
// Aplicar la ecuacion de inercia
this.shapeX = (this.shapeX+(this.distX/20));
this.shapeY = (this.shapeY+(this.distY/20));
// realizar la animacion
this._x = this.shapeX;
this._y = this.shapeY;
// recordar ultima posicion del raton para decidir
this.oldTargetX = this.targetX;
};
};
for (i=0; i<20; i++) {
_root.attachMovie("bug", "bug"+i, i);
fly.apply(_root["bug"+i]);
} 