mardi 6 décembre 2016

How to load external swf with access stage in document class?

I have a main swf that loads other swfs. Everything works correctly with the code below that is inside the main swf (sketch):

var loader:Loader = new Loader();
loader.load(new URLRequest('external.swf'));

However, when trying to load an external swf that uses a document class, it had an access error to the stage object. To be clearer, a document class is configured in the swf publication that will be loaded:

Classe de documento Main

Inside the, have the class for the access code to the stage:

package {
    import flash.display.MovieClip;
    public class Main extends MovieClip {
        public function Main() {
            // access stage

When the main swf tries to load the external swf, the error occurs:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

How to solve this problem?

Aucun commentaire:

Enregistrer un commentaire