I have a textfield that i want to pass the name of a swf file to be loaded. Its working when i put the name of the file in the URLRequest(“walk.swf”).
but when i try and pass it like this:
trace(textf.input.text); // walk.swf
var theUrl:String = textf.input.text;
var mRequest:URLRequest = new URLRequest(theUrl);
i get :
[COLOR=#ff0000]Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
[/COLOR]i cast it as a string. what am i missing here?
function displayKey(keyEvent:KeyboardEvent) {
if(keyEvent.charCode == 13){
loader2 = new Loader();
loader2.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
trace(textf.input.text); // walk.swf
var theUrl:String = textf.input.text;
var mRequest:URLRequest = new URLRequest(theUrl);
loader2.load(mRequest);
}
}
function onCompleteHandler(loadEvent:Event){
var mc2 = loadEvent.currentTarget.content.getChildAt(0);
addChild(mc2);
}
help much appreciated.
B