laylo
04-05-2012, 11:30 AM
basically, i got this space game to make and i've created a ship, then exported it for ActionScript. this is the code inside the ship.
package {
import flash.display.MovieClip;
import flash.events.Event;
public class mainShip extends MovieClip
{
public function mainShip()
{
stage.addEventListener(Event.ENTER_FRAME, keyPressed);
function keyPressed(event:Event):void
{
switch (this.ship)
{
case key.isDown.Keyboard.RIGHT :
x += 5;
break;
default :
break;
}
}
}
}
}
i got an error undefined property of key. any suggestions?
package {
import flash.display.MovieClip;
import flash.events.Event;
public class mainShip extends MovieClip
{
public function mainShip()
{
stage.addEventListener(Event.ENTER_FRAME, keyPressed);
function keyPressed(event:Event):void
{
switch (this.ship)
{
case key.isDown.Keyboard.RIGHT :
x += 5;
break;
default :
break;
}
}
}
}
}
i got an error undefined property of key. any suggestions?