Comunidad de diseño web y desarrollo en internet online

No Entiendo Pasar los fotogramas al Stage !

Citar            
MensajeEscrito el 14 Ene 2012 06:52 pm
Hola Foreros como les va?.... pues he aqui otro inconveniente, He puesto a mi muñeco en el stage mediante AS se puede mover y todo hacia todas las direcciones con las flechas pero no hace la animación....he aqui el codigo del muñeco que se llama "Ship"

Por cobeli

13 de clabLevel



 

firefox
Citar            
MensajeEscrito el 14 Ene 2012 06:56 pm
Disculpen Moderadores pero no logro ver para poner los codigos solo me salen los emoticones...

De todas maneras aqui esta el codigo del "Ship":

package com.esedeerre
{
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import com.senocular.utils.KeyObject;


public class Ship extends MovieClip
{

private var stageRef:Stage;
private var key:KeyObject;




private var velocidad :uint = 4;



public function Ship(stageRef:Stage)
{
stop();
this.stageRef = stageRef;
key = new KeyObject(stageRef);




addEventListener(Event.ENTER_FRAME, loop, false, 0, true);



}

private function loop(e:Event) : void
{
if (key.isDown(Keyboard.LEFT))
x -= velocidad;
gotoAndPlay("link_left");



else if (key.isDown(Keyboard.RIGHT))
x += velocidad;
gotoAndPlay("link_right");




if (key.isDown(Keyboard.UP))
y -= velocidad;
gotoAndPlay("link_up");



else if (key.isDown(Keyboard.DOWN))
y += velocidad;
gotoAndPlay("link_down");






}
}
}

Por cobeli

13 de clabLevel



 

firefox
Citar            
MensajeEscrito el 14 Ene 2012 10:58 pm
Me sale este error :( :

Ship.as, Line 49 1083:Syntax error: else is unexpected else if (key.isDown(keyboard.RIGHT));

Por cobeli

13 de clabLevel



 

firefox

 

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