I'm currently trying to add the resulting XML (xmlResult) to a textbox that is on the stage. I did try using MovieClip(root).[instancename].text = ..... however it didn't work - null object reference? Any suggestions? Thanks!
package {
public class ChatHistory extends MovieClip {
public function ChatHistory()
{
//constructor
}
public function getChatText() {
var loader:URLLoader = new URLLoader();
loader.addEventListener( Event.COMPLETE, requestComplete);
var requestURL:URLRequest = new URLRequest("http://localhost:80/chathistory.xml");
requestURL.method = URLRequestMethod.GET;
loader.load(requestURL);
}
private function requestComplete( event:Event ):void {
try {
var xmlResult:XML = new XML(event.target.data);
trace(xmlResult);
} catch ( e:TypeError ) {
trace(e.message);
}
}
}
}