1 Reply Latest reply on Aug 21, 2007 9:11 AM by FlashTastic

    Frame names and how to invoke them

    Kiruno
      What would you have to do to have something happen once a movieclip reaches a particular frame?

      I already got the answer to that question in a previous topic in case that something has to happen when the movieclip ends, but say you want to have something happen when the playhead reaches frame called, say, _now?

      I can think of a way (involving the clculation of the ratio between _currentframe and _totalframes) but, isn't there a simpler -and more precise- way, namely, invoking the frame by its name? How would that be done (if possible)?

      NOTE: I am assuming that adding code to the movieclip's timeline (instead of adding it to the main timeline) is a bad practice and should be avoided. Am I right at that?
        • 1. Re: Frame names and how to invoke them
          FlashTastic Level 1
          You can only target frame labels using the gotoAndPlay or gotoAndStop commands. If you want to detect whether a movieclip is on a certain frame, you could use the _currentframe to detect the frame number (no strings), or you could set a variable on the movieclip timeline, i.e. frameName = "_now", and then check for movieclip.frameName.

          Cheers,
          FlashTastic