layout="vertical" creationComplete="checkMessages();">
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
private function checkMessages( event:Event = null ) : void {
var url:String = "http://localhost/aschat/messages.php?t="+((new Date()).valueOf());
var htMessages:HTTPService = new HTTPService();
htMessages.url = url;
htMessages.resultFormat = 'e4x';
htMessages.addEventListener(ResultEvent.RESULT, onMessages);
htMessages.send();
}
private function onMessages( event:ResultEvent ) : void {
var messages:Array = [];
for each( var msg:XML in event.result..message ) {
messages.push( { user: msg.@user, message: msg.valueOf() } );
}
dgMessages.dataProvider = messages;
}