shake MovieClip prototype          

Clasificado bajo: AS2 (deprecated) — drus @ 11:28 pm

Genera un temblor en la cantidad definida por el parámetro value. Si se usa sin parámetros detiene el temblor.

Actionscript:
MovieClip.prototype.shake = function(value) {
    if (value) {
        this.orgX = this._x;
        this.orgY = this._y;
        this.onEnterFrame = function() {
            this._x = this.orgX+Math.random()*(value*2)-value;
            this._y = this.orgY+Math.random()*(value*2)-value;
        };
    } else {
        delete this.onEnterFrame;
        this._x = this.orgX;
        this._y = this.orgY;
    }
};
//Uso 1
obj_mc.shake(5);//provoca un temblor de 5 pixeles
//Uso 2
obj_mc.shake();//detiene temblor

Enlaces relacionados: No related posts, | Tags: , , , , ,



Siguiente página »

AS_toolKit | Powered by WordPress | Skinned by Drus Unlimited | RSS Feed | Copyleft