So I have this class “G” that I use for global vars, and that kind stuff.
Now I want to dispatch an event from that class and no matter what I do the compiler throws the same error: “Call to a possibly undefined method dispatchEvent.”
I have already tried extending the EventDispatcher class…
package {
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.EventDispatcher;
public class G extends EventDispatcher{
public static var v:Object = {};
public static var scope:Array = [];
public static var xml;
static var cargadorXml;
public static function initXml():void {
cargadorXml = new URLLoader();
cargadorXml.addEventListener(Event.COMPLETE, loaded);
cargadorXml.load(new URLRequest("config.xml"));
}
public static function loaded(e):void {
xml = new XML(cargadorXml.data);
dispatchEvent(new Event("xml"));
}
}
}
What am I doing wrong?