0
votes

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)
    }
}

}

1
are you adding the instance of your gfxs class to the stage? You need to show how you use this class for an accurate answer to be madeBadFeelingAboutThis
where are you calling placeCar and is gfxs added to the stage?Gone3d

1 Answers

0
votes

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.