3 Replies Latest reply on Jun 2, 2009 2:34 PM by BennyBeta

    Creating a custom event

    SiHoop Level 1

      I'm using a class with an instance name of textParser1. After creating the instance I want to be able to use a property of the class, but the value that is returned appears to be returned too soon (i.e. before the class has finished processing completely).

      Here's what I want to do:

      textParser1 = new TextParser(content);

      trace(textParser1.someVal);

       

      I believe the solution is to create a custom event, but don't know how to do this. Here's what I think I should be doing:

      textParser1 = new TextParser(content)
      textParser1.addEventListener(Event.????,completeListener)
             
      function completeListener():void{
             trace(textParser1.someVal)
      }

      Is this correct and can you point me to an example of the right way to do this.

      Thanks for your time.