# AS3 Symbol not showing returns no errors?

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;
import flash.events.Event;

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 {
}
override public function update(e:Event):void {
initShip();
}
}


}

Thanks, for the help :P

• 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. May 25, 2012 at 19:48
• Thanks for the tip! I actually just figured out what was wrong. May 25, 2012 at 20:59

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:

stage.addChild(spaceShip);


to

stage.addChild(ship);


Change this

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


to

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.