Comunidad de diseño web y desarrollo en internet online

Cambiar tamaño de un Mc con easing

Citar            
MensajeEscrito el 09 Abr 2007 12:39 pm
Hola, cómo están ??.. espero que bien, mi duda es la siguiente, quiero cambiar las dimensiones de un MC con efecto de easign, para esto uso esta función que pongo en el 1er frame de mi pelicula:

Código :

function redimensionar(x,y,ancho,alto, aceleracion) {
    Clip.onEnterFrame = function() {
        this._x += (x-this._x)/aceleracion;
        this._y += (y-this._y)/aceleracion;
        this._width += (ancho-this._width)/aceleracion;
        this._height+= (alto-this._height)/aceleracion;
        if (Math.abs(x-this._x)<0.5 && Math.abs(y-this._y)<0.5 && Math.abs(ancho-this._width)<0.5 && Math.abs(alto-this._height)<0.5) {
            this._x = x;
            this._y = y;
            this._width = ancho;
            this._height = alto;
            delete this.onEnterFrame;
        }
    };
}


al MC que quiero cambiar de dimensiones lo llamo redimensionar , y llamo a esta función desde un btoton con este Código

Código :

boton_btn.onRelease = function (){
redimensionar(100,100,10,10,3); 
}


la verdad no sé , en qué ando mal, por que no llega a funcionar, si alguièn me podria hechar un cable la verdad le estaría muy agradecido y un saludo a todos.

Por look24

26 de clabLevel



Genero:Masculino  

Río Grande - Argentina

firefox
Citar            
MensajeEscrito el 09 Abr 2007 03:02 pm
Es que esa clase de funciones se aplican mejor como prototipos:

Código :

MovieClip.prototype.redimensionar = function (x,y,ancho,alto, aceleracion) {
   this.onEnterFrame = function() {
        this._x += (x-this._x)/aceleracion;
        this._y += (y-this._y)/aceleracion;
        this._width += (ancho-this._width)/aceleracion;
        this._height+= (alto-this._height)/aceleracion;
        if (Math.abs(x-this._x)<0.5 && Math.abs(y-this._y)<0.5 && Math.abs(ancho-this._width)<0.5 && Math.abs(alto-this._height)<0.5) {
            this._x = x;
            this._y = y;
            this._width = ancho;
            this._height = alto;
            delete this.onEnterFrame;
        }
    };
};

Código :

boton_btn.onRelease = function () {
miMC_mc.redimensionar (100, 100, 10, 10, 3); 
}
Creo que así funciona.

Por HernanRivas

Claber

3416 de clabLevel

26 tutoriales

 

Argentina

msie
Citar            
MensajeEscrito el 09 Abr 2007 04:56 pm
Epa quedo rechulo, muchas gracias de verdad.
_saludos

Por look24

26 de clabLevel



Genero:Masculino  

Río Grande - Argentina

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.