Question

Here's my code, the problem is that it doesn't add the sprite when i call it from my main function in main.

package{

import flash.display.*;
import flash.events.*;

public class gfxs extends MovieClip{

    public function gfxs(){
    }
    public function placeCar(){
       var car:MoonCar = new MoonCar();
       car.x = 100;
       car.y = 372;
       addChild(car);
       trace("PLACED CAR"); //JUST TO CHEK IF IT RUNS THIS CODE(IT DOES)
    }
}

}

Was it helpful?

Solution

You need to add gfxs to the stage in your main class. For example in you main.as you might have something like this :

var myGfxs:gfxs = new gfxs();
myGfxs.placeCar();
addChild(myGfxs);

Hard to give a definitive answer as we canot see what you have done in your main.as file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top