I’m very new to the AS2->AS3 transition, just found out sendAndLoad no longer exists in its easy glory. So I found this template;
package {
import flash.events.*;
import flash.net.*;
import flash.text.*;
public class SendAndLoadExample {
public function SendAndLoadExample() {}
public function sendData(url:String, _vars:URLVariables):void {
var request:URLRequest = new URLRequest(url);
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
request.data = _vars;
request.method = URLRequestMethod.POST;
loader.addEventListener(Event.COMPLETE, handleComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
loader.load(request);
}
private function handleComplete(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
trace("Par: " + loader.data.par);
trace("Message: " + loader.data.msg);
}
public function onIOError(event:IOErrorEvent):void {
trace("Error loading URL.");
}
}
}
The thing is I cannot load the php-file from the internet to my local swf, thus not being able to see any trace results
I tried to make a TextArea component on the Stage and send the results there, but can’t find a method to do so (MovieClip(root).something didn’t work).
What would be the best way to view the results without using trace?