Hi, I am new to AS3 so please forgive me for asking something which is probably pretty straightforward to solve.
I am trying to load an image onto the stage using an external AS3 class. I'm not sure if this is the best way to do it but I started off with a tutorial so was following that.
My object (movieclip) has the class 'Mountain' and is called 'Mountain_mc'.
My external AS3 class file is called 'Mountain' and this is the code (it is stored at the same level of project folder as the Flash file which I am trying to load the image on to the stage) -
package { import flash.display.MovieClip; import flash.display.Stage;
public class Mountain extends MovieClip
{
public function Mountain()
{
var myMountain:Mountain = new Mountain();
stage.addChild(myMountain);
myMountain.x = stage.stageWidth/2;
myMountain.y = stage.stageHeight/2;
trace ("I am a mountain");
}
}
}
I am not getting any Errors, but also the trace command isn't working and my image doesn't appear on the stage. Any help would be very gratefully received. I have spent far too long trying to figure this out and I am getting nowhere.
Thanks!