Diseñador de Oscommerce

Archivo de la categoria 'Movimiento mediante código'

Sep 05 2008

Tutorial - Hacer animación en flash mediante Código


 Powered by Max Banner Ads 

Hola Amigos, ya estoy de vuelta de las vacaciones y voy a empeza con este tutorial para que veais lo facil que es hacer una animación en flash mediante código, usando la Clase Tween.

EFECTO REBOTE MEDIANTE CODIGO - FLASH (VER EJEMPLO)

1. NUEVO DOCUMENTO .FLA

2. CREAMOS UN CLIP DE PELICULA Y LE DAMOS DE NOMBRE DE INSTANCIA : bola

3. CREAMOS 2 BOTONES, UNO CON EL TEXTO “EFECTO” Y OTRO “REINICIAR”.

en el boton efecto , dentro de este clip, en el fotograma 1 del clip, insertamos éste código:

this.onRelease = function(){
var animacion = new mx.transitions.Tween(_parent.bola, “_y”, mx.transitions.easing.Bounce.easeOut, _parent.bola._y , _parent.bola._y +100, 60)
animacion.onMotionFinished = function(){
_root.boton_efecto._visible = false;
_root.boton_reiniciar._visible = true
}
}

y en el botón reiniciar, dentro del mísmo, en el fotograma 1, insertamos éste código:

this.onRelease = function(){
var animacion = new mx.transitions.Tween(_parent.bola, “_y”, mx.transitions.easing.Elastic.easeOut, _parent.bola._y , _parent.bola._y -100, 60)
animacion.onMotionFinished = function(){
_root.boton_efecto._visible = true;
_root.boton_reiniciar._visible = false;
}
}

IMPORTANTE, al boton efecto , hay que ponerle el nomvre de instancia: “boton_reiniciar” y al boton efecto el nombre de instancia : “boton_efecto”. Todo funcionará perfectamente:

Cualquier duda, a mi correo. Saludos

No hay comentarios

Lineagrafica