Hi, I am having the following class:
package
{
public class Controller
{
private static var singleInstance:Controller;
public static function getInstance():Controller
{
if(singleInstance == null)singleInstance = new Controller();
return singleInstance;
}
public static function _trace(str:Object):void
{
singleInstance.texttrace.text += "\n" + str
}
}
}
When I try to call Controller trace method, the following errors are
returned:
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at Controller$/_trace()
The following code is used to load the SWf file:
var loader:Loader = new Loader();
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
loader.contentLoaderInfo.addEventListener(Event.INIT, this.handler);
loader.load(new URLRequest(source), context);
I am calling Controller.trace when the INIT event execute. Am I doing
things wrongly?
Thanks and regards,
Shunjie