[RESOLVED] TypeError 1034. Possibly a URLRequest/ URLLoader problem.
Peek-a-boo, me again. I'm having some trouble with loading in a txt-file and I can't figure out why, as it works in a new .fla file as well. Here's the code in a nutshell:
PHP Code:
goldstar.addEventListener(MouseEvent.MOUSE_DOWN, showHS);
var weekrequest:URLRequest = new URLRequest("weekscores.txt");
var weekloader:URLLoader = new URLLoader();
//weekloader.dataFormat = URLLoaderDataFormat.VARIABLES;
//Not sure on this one, reading in data like this is completely new to me.
weekloader.addEventListener(Event.COMPLETE, checkWeek);
function showHS(MouseEvent):void{
weekloader.load(weekrequest); // --> checkWeek
trace("loaded"); //This works
}
function checkWeek(event:Event):void{
var loader2:URLLoader = URLLoader(event.target);
//This seems to be the problem.
var variables:URLVariables = new URLVariables(loader2.data);
}
This gives me the following error:
Code:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Stage@2cdcf191 to flash.net.URLLoader.
at Game_fla::MainTimeline/checkWeek()
at Game_fla::MainTimeline/launchloop()
I've also tried several different traces, but they either returned null or nothing, but there's definitely an array of numbers in the .txt file.
As always, thanks in advance.
-Patrick