1
I have a main swf that loads other swfs. Everything works correctly with the code below that is within the main swf (sketch):
var loader:Loader = new Loader();
stage.addChild(loader);
loader.load(new URLRequest('external.swf'));
However, when trying to load an external swf using a document class, an object access error has started to occur stage
. For clarity, the document class is configured in the post of the swf that will be loaded:
Within the class Main.as
there is the access code to the Stage:
package {
import flash.display.MovieClip;
public class Main extends MovieClip {
public function Main() {
// tentar acessar o stage:
trace(stage);
trace(stage.stageWidth);
}
}
}
When the main swf tries to load the external swf, the error occurs:
null
TypeError: Error #1009: Cannot access a property or method of a null object reference.
How to solve this problem?