External class problems with event function

Hi:
First of all, I would like to let you know that I am totally new to creating packages and classes externally from the main document.

I am currently trying to create a class that connects to a php file, gets some information and returns it into a String in the main timeline. I believe my problem is related to the fact event functions cannot return any value; but then, how can I get my string?

Here is the class:


package {
  import flash.display.*;
  import flash.events.*;
  import flash.net.*;

  public class CommentMaker extends Sprite {
  
  private var myLoader2:URLLoader = new URLLoader()

    public function CommentDisplayer(idNum) {

    myLoader2.dataFormat = URLLoaderDataFormat.VARIABLES
   
    myLoader2.load(new URLRequest('flashFile.php?id='+idNum))

    myLoader2.addEventListener(Event.COMPLETE, onDataLoad)
 
   function onDataLoad(evt:Event):String{
    var commentString:String = "";
        for(var i:uint=0; i<evt.target.data.cant; i++){
            var commentString = evt.target.data['Title'+i];

                              }
            return commentString;
                                     
                           }
                        
        }
        
  }

And here, in my main document:


var theComments:CommentMaker = new CommentMaker();
trace(theComments.CommentDisplayer(5));

What I want to get back is the commentString value I tried to returned. I think the problem is that I’m trying to return a value from an event function. I tried to return whatever variable from the main function CommentDisplayer and I got it back properly, but how - from loading the CommentDisplayer function, can I get the value of the string that is inside the event function (OnComplete).

Also, if you know where I can find good information on how to create good classes, I would be grateful.

Thanks a lot.
Didi