I’m very new to AS3 and I have been stuck with this problem for weeks. I have tried asking others, but they assume that I am just trolling. I’m trying to get this code to do something:
package source.map{
import flash.display.MovieClip;
import flash.display.Stage;
import source.map.dbox;
public class BlockPlace extends MovieClip{
public function BlockPlace() {
var blah:MovieClip = new dbox();
stage.addChild(blah);
db.x = stage.stageWidth / 2;
db.y = stage.stageHeight / 2;
}
}
}
“dbox” is what I am trying to add to the stage. I have set up linkage settings and made sure that the class was in the right location, but for some reason even tracing in the function isn’t working. I’m used to putting code directly in the timeline and I have just recently started using classes. I have multiple books on AS3 and I am really trying my hardest to understand the core concepts behind the language.
Just follow the step-by-step tutorial I put up in the comments, from active tuts: Quick Tip How to use a document Class in Flash.
It’s thought for beginners and programmers that are used to place the code in the timeline. I think it covers quite well your problem, and it shouldn’t be hard to follow.
Hope this helps!