1 Reply Latest reply on Oct 9, 2008 8:07 AM by Peter Lorent

    Returning data from a class

    SiHoop Level 1
      How do I create an event handler to check that a class has completed its tasks before I continue with my next line of code? For example, in the code below, the class that is being used must hit a database before it is able to return a value for myVar. However, the trace statement executes before the value of myVar has been changed.
        • 1. Re: Returning data from a class
          Peter Lorent Level 2
          If you are loading from a database you have a listener function on the result, something like onResult(event:ResultEvent)
          In that listener function you usually parse the data and then dispatch a (custom) event that the data has loaded. Any object that needs to know about this event, registers for the event and in a listener function you can proceed with your code.