Animación básica en Flash
Práctica para crear una calculadora sencilla con Flash
Práctica de arrastrar objetos por el escenario
Práctica de gota llenando vaso
Practica del Robot moviendo las piernas
Vídeotutorial de movimiento con flash
Movimiento combinado de escena y clip de película con botones de PLAY y STOP
Navegación mediante botones en Flash
Primer juego en Flash
Animación interactiva
Presentación interactiva en flash
Reproductor mp3
código fotograma principal:
Código
var musica:Sound=new Sound;
musica.loadSound("01.mp3", false);
var tiempo:Number=0;
onEnterFrame=function(){
info.text=musica.position/1000+" / "+musica.duration/1000;
}
código de botón play:
on(release){
musica.start(tiempo);
}
código de botón stop:
on(release){
musica.stop();
tiempo=musica.position/1000;
}
Práctica para mover y rotar un clip de película con los cursores del teclado.
Creáis un clip de película y le ponéis de nombre de instancia nave y en el primer fotograma ponéis el siguiente código:
Cuadro de texto
onEnterFrame = function () {
if (Key.isDown(Key.LEFT)) {
nave._rotation -= 5;
}
if (Key.isDown(Key.RIGHT)) {
nave._rotation += 5;
}
if (Key.isDown(Key.UP)) {
nave._x += 5*Math.sin(nave._rotation*Math.PI/180);
nave._y -= 5*Math.cos(nave._rotation*Math.PI/180);
}
if (Key.isDown(Key.DOWN)) {
nave._x -= 5*Math.sin(nave._rotation*Math.PI/180);
nave._y += 5*Math.cos(nave._rotation*Math.PI/180);
}
angulo.text = nave._rotation;
sin.text=nave._x;
cos.text=nave._y;
};
código primer fotograma
var velocidady:Number = 0;
var velocidadx:Number = 0;
var gravedad:Number = 0.5;
var tiempo:Number = 0;
var subir:Boolean = false;
var derecha:Boolean = false;
var puntos:Number=0;
re.onPress=function(){
onEnterFrame = function(){
if(!subir) {
velocidady += gravedad;
pelota._y += velocidady;
}
if (subir) {
velocidady -= gravedad;
pelota._y -= velocidady;
}
if (derecha) {
pelota._x += velocidadx;
}
if (!derecha) {
pelota._x -= velocidadx;
}
if (velocidady<=0) {
subir = false;
}
if(pelota._y>400){
puntos-=1;
pelota._x=275;
pelota._y=10;
subir = false;
velocidady = 5;
velocidadx = 0;
}
if(pelota._x>550){velocidadx=-velocidadx}
if(pelota._x<0){velocidadx=-velocidadx}
if (pelota.hitTest(barra)) {
puntos+=1;
subir = true;
velocidady = 15;
velocidadx = 7;
if (pelota._x>barra._x) {
derecha = true;
}
if (pelota._x<barra._x) {
derecha = false;
}
}
if (barra._x<500) {
if (Key.isDown(Key.RIGHT)) {
barra._x += 10;
}
}
if (barra._x>50) {
if (Key.isDown(Key.LEFT)) {
barra._x -= 10;
}
}
};
}