jeudi 24 septembre 2015

Loader is returning a null object in as3

I am trying to make a menu that calls another swf file when the button is clicked. however, the message returned is- TypeError: Error #1009: Cannot access a property or method of a null object reference. at GameController()

the GameController() given above is the document class of the called "HotAirRises.swf"

the code is given below: package {

import flash.display.MovieClip;
import fl.controls.Button;
import flash.events.MouseEvent;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;

public class MainController extends MovieClip {


    public function MainController() 
    {
        tester.addEventListener(MouseEvent.CLICK, testIt);
        // constructor code
    }
    private function testIt(e:MouseEvent)
    {
        trace("testing");
        var myLoader:Loader = new Loader();                    
        var url:URLRequest = new URLRequest("HotAirRises.swf"); 
        trace(myLoader,url);
        myLoader.load(url,null);
        addChild(myLoader);
    }
}

}

What am i missing here? something to do with the other HotAirRises.swf file? Please Help!

Aucun commentaire:

Enregistrer un commentaire