6 Replies Latest reply on Dec 3, 2007 6:11 AM by robdillon

    looping a flash movie

    AllureDev
      I have been unable to find the correct property to test on a flash video to see if it is running or not.

      for an avi, i check the movierate, if it is not equal to 1, the video has stopped playing.
      for a wmv, i get its duration and loop for that length of time.

      is there a similar property or technique for a flash video?

      here is the code for the behavior on the avi member that i am referring to:

      property s

      on beginSprite me
      s = sprite(me.spriteNum)
      end

      on exitFrame me
      if s.movieRate = 1 then go to the frame
      end

        • 1. Re: looping a flash movie
          robdillon Most Valuable Participant
          playing

          if sprite(X).playing then
          -- do something
          else
          -- do something else
          end if
          • 2. Re: looping a flash movie
            AllureDev Level 1
            playing always reports back as 1 under this scenario

            i set the movie in to the sprite as 1 frame, then loop until it is done...... that way i can drop in any movie of any length and it will play until done. however, using a flash movie in this manner i cant detect when it is done.

            thanks
            • 3. Re: looping a flash movie
              AllureDev Level 1
              sample code

              property s

              on beginSprite me
              s = sprite(me.spriteNum)
              end

              on exitFrame me
              put s.playing -- display setting to message window
              if s.Playing then go to the frame
              end

              • 4. Re: looping a flash movie
                robdillon Most Valuable Participant
                If the flash movie has more than one frame then you can test the currentframe property.

                property s
                property totalframes

                on beginSprite me
                s = sprite(me.spriteNum)
                totalframes = s.member.frameCount
                end

                on exitFrame meon exitFrame me
                if s._currentFrame >= totalFrames then
                -- do something
                end if
                end

                end
                • 5. Re: looping a flash movie
                  AllureDev Level 1
                  Rob,

                  that did the trick! Thanks. Still learning about Director, how can i find all of the properties (ie member._currentframe) that are available? I looked in the lingo dictionary, online, help, ect.... I did mess with the framecounts and other data to no avail....

                  thank you in advance.
                  • 6. Re: looping a flash movie
                    robdillon Most Valuable Participant
                    Working with Flash in Director is somewhat undocumented. There is a full dictionary and contextual listing of Lingo in both the Script window and the Message window. The Message window is very handy for testing code before you commit to a behavior. In MX2004 when working with Flash 8, you can usually reach any Flash function, method or property by using Actionscript after the reference to the Flash sprite in Lingo. For instance you can find the current frame of a Flash .swf by using:

                    sprite(X)._currentFrame

                    If you need to reach a movieClip in the .swf then just include the clip's instance name in the path:

                    sprite(X).clipName._currentFrame

                    for example.

                    Take a look at the read me that comes with the Director 10.1 update for some other insights.