0 Replies Latest reply on Feb 20, 2008 3:13 PM by Rothrock

    Making Events for Custom Class

    Rothrock Level 5
      I'm working on a custom class that handles synching of externally loaded audio and some timeline animations -- nothing high-paced and millisecond timed. I've got it all working fairly well, but I'm wondering how my custom SyncAnimation class can tell others that it is done? In other words, how can I have it tell others when it gets to the last frame that it has reached the last frame?

      I know how to use the EventDispatcher class and can dispatch events. If I initilize the SyncAnimation class as a Dispatcher I guess I could put

      dispatchEvent({type:"onComplete",target:this});

      on the last frame. Or I could start a loop in the class that just keeps checking if it is on the last frame and when it is dispatch the event. Or perhaps something else that I haven't thought of?

      I want to keep as much code in the class as possible, because various developers will be creating the timeline animations and the fewer things on the timeline that could be messed up the better.

      Anybody have any clever ways they've dealt with this before?