Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I haven't touched Flash in a while and I've forgotten a lot.

I'm trying to get a space-ship symbol to show in the middle of the screen. For some odd reason it isn't showing in the middle of the screen or even appearing. There's no error in the output or an error in the debug.

Here's some code below.

I'm coding in Coda 2 and using Flash to manage the library. I currently only have one class called Game.As and the ship symbol is a MovieClip with the name shipSymbol and the class is defined as shipBase with the base class being flash.display.MovieClip;

package {

import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.display.Stage;

public class Game extends MovieClip {

    //Spaceship Symbol 
    private static var ship = spaceShip;

    private function initShip(startX = number , startY = number):void {
        ship = new spaceShip();
        this.x = startX;
        this.y = startY;
        startX = stage.stageWidth /2;
        startY = stage.stageHeight /2;
        trace("Space-Ship Spawned");
    public function runGame():void {
        stage.addEventListener(Event.ENTER_FRAME , update);
    override public function update(e:Event):void {


Thanks, for the help :P

share|improve this question
Your code is a little confusing. You seem to be calling initShip() on each frame. The parameters to initShip have default value "number", which is probably undefined. I think you meant to type them as Number, which you would write startX:Number, startY:Number. – Danik May 25 '12 at 19:48
Thanks for the tip! I actually just figured out what was wrong. – Monstr92 May 25 '12 at 20:59
up vote 2 down vote accepted

Few things wrong...

parameters should be...

initShip(startX : Number , startY : Number) 

and not

initShip(startX = number , startY = number)

This seems misplace:

startX = stage.stageWidth /2;
startY = stage.stageHeight /2;

This should change from:




Change this

this.x = startX;
this.y = startY;


ship.x = startX;
ship.y = startY;

probably not legal:

private static var ship = spaceShip;

set it to null.

If ship still does not appear, then make sure you check the "export symbol" via the library where you typed in "spaceShip" for this symbol (I don't have flash to tell you correct/specific name).

You should have got errors anyway and since you didn't you probably not got the class name field setup in the project dialogue. I can't be more specific on this, someone who has flash on their machine will probably give you a better answer on this.

share|improve this answer
Thanks! This worked! – Monstr92 May 25 '12 at 21:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.