1 Reply Latest reply on Aug 24, 2006 3:17 PM by Newsgroup_User

    Waiting for class instatiation

    Level 7
      What is the best way to achieve the following:

      My _root timeline reaches frame 10 labeled init. On this frame their are
      several MovieClips on the stage, and a couple are attached at run time.
      Each of these MovieClips is defined by a class and each contains a doInit()
      function.

      First off, is a class Object instantiated when an instance of it appears on
      the Stage or is attached, is that right? Second, say I have 6 different
      instances of these MovieClips and each is running a doInit function... what
      is the best way to alert another function (a function that will actually
      move these MovieClips onto the Stage with _x, _y and _alpha Tweening) after
      all of my classes doInit() function are done.

      I figured I could create an instance property (Boolean) in each class to
      define its completion status called isInited... then have a timer loop
      checking the return values of all the classes for some method like
      getIsInited() and only running my Tween functions at that time then delting
      itself.

      But, I also figure there is a way to do it with a listener/broadcaster
      solution. It makes a lot more sense to me to have the classes either inited
      in a chain with the final one broadcasting a message, or have each one
      broadcast a message and only run when all have been broadcast... does this
      make any sense?

      I have not done to much with listerners expept for movieclip loaders. Is
      this a job for adBroadcast?

      Thanks for any help.


        • 1. Re: Waiting for class instatiation
          Level 7

          "SMB" <mail@actionscriptpost.com> wrote in message
          news:ecl7of$ce7$1@forums.macromedia.com...
          > What is the best way to achieve the following:
          >
          > My _root timeline reaches frame 10 labeled init. On this frame their are
          > several MovieClips on the stage, and a couple are attached at run time.
          > Each of these MovieClips is defined by a class and each contains a
          > doInit() function.
          >
          > First off, is a class Object instantiated when an instance of it appears
          > on the Stage or is attached, is that right? Second, say I have 6
          > different instances of these MovieClips and each is running a doInit
          > function... what is the best way to alert another function (a function
          > that will actually move these MovieClips onto the Stage with _x, _y and
          > _alpha Tweening) after all of my classes doInit() function are done.
          >
          > I figured I could create an instance property (Boolean) in each class to
          > define its completion status called isInited... then have a timer loop
          > checking the return values of all the classes for some method like
          > getIsInited() and only running my Tween functions at that time then
          > delting itself.
          >
          > But, I also figure there is a way to do it with a listener/broadcaster
          > solution. It makes a lot more sense to me to have the classes either
          > inited in a chain with the final one broadcasting a message, or have each
          > one broadcast a message and only run when all have been broadcast... does
          > this make any sense?
          >
          > I have not done to much with listerners expept for movieclip loaders. Is
          > this a job for adBroadcast?
          >
          > Thanks for any help.
          >

          I just thought of something and tried it. I removed a couple of component
          comboBoxes from a MovieClip instance on the Stage that acts as a selection
          interface. It seems that when I do my Tweens, the load is too much and the
          Tween is not seen. Any ideas here?