Custom event function with return value?

Hai gais!

So, I have a question regarding events. This may have been asked before, but I wasn’t sure what to search for to get answers so I’m going to ask anyway.

The problem has to do with loading external contents, and then assigning the loaded contents to a variable.

Basically, I’d like this to work:

var xml:XML = loader.addEventListener("complete", return_xml);
trace(xml);

function return_xml(event:Event):XML {
   return XML(myLoader.data);
}

Is there some kind of solution or workaround for this, maybe with a custom event class or something?

/ Frank