views:

146

answers:

1

I have an asp page that loads a response " user=exists " everytime I try to update a database record (when of course the record already exists!) How can I handle this response with AS3 in Flash?

A: 

assuming you are using a URLLoader...

// Create a URLLoader to handle sending and loading 
loader = new URLLoader();

/ add listeners
if (!loader.hasEventListener( Event.COMPLETE)) {
    loader.addEventListener( Event.COMPLETE, handleResponse );
}

// send the data to the URL
loader.load( request );

and then the handleResponse function

private function handleResponse(e:Event ):void{
    trace( "Returned : " + new String(e.target.data));
}

e.target.data being the response,

hope this helps

Daniel
Thanks for you answer. Can you please also mention what if the response is in an XML format like: <user>exists</user>?
Dimitree
then instead of `new String(e.target.data)` you could use `new XML(e.target.data)`
Daniel