1 Reply Latest reply on Feb 1, 2008 9:12 AM by Newsgroup_User

    Looping Playback until SWF is complete

    gtrufitt
      Hi, I am using flash SWF animations within my director movie, with markers seperating each one. How do I loop the playback so that the full flash animation plays and then moves to another marker?

      Also, is there any way to have a button appear after a certain amount of time that the SWF has been playing for? IE: if the swf plays for 200 frames a scene at 12 fps and I want a button to appear half way thtough the second scene, how would I do this?

      Thanks, Gareth
        • 1. Re: Looping Playback until SWF is complete
          Level 7
          You add a frameScript to monitor the Flash file for completion before
          allowing the playhead to continue. Something like (watch for
          unintentional line-breaks):
          -- warning: will only work for Flash sprites whose animation is on _root,
          -- and not for one where the animations is buried in a movieClip
          property flashSprite
          property flashFrameCount
          property bEnabled

          on isOKToAttach me, sType, sNum
          return (sType = #script)
          end

          on getPropertyDescriptionList
          lRange = []
          repeat with c = 1 to the lastChannel
          if sprite(c).member.type = #flash then lRange.append(c)
          end repeat
          pdl = [:]
          pdl[#flashSprite] = [#comment: "Flash sprite channel:", #format:
          #integer, #default: 0, #range: lRange]
          return pdl
          end

          on beginSprite me
          bEnabled = 1
          flashSprite = sprite(flashSprite)
          tMember = flashSprite.member
          if tMember.type <> #flash then
          bEnabled = 0
          exit
          end if
          flashFrameCount = tMember.frameCount
          end

          on exitFrame me
          if bEnabled then
          if (flashSprite.frame = flashFrameCount) then
          tFrame = _movie.frame + 1
          else
          tFrame = _movie.frame
          end if
          _movie.go(tFrame)
          end if
          end