1 Reply Latest reply on Jun 24, 2006 9:07 AM by James Newton, ACP

    Control film loop

    Level 7

      I have a film loop of one little animation sprite (only one jump). I need to
      control that when push a button the film loop run and finish its animation,
      but when the button push again, the film loop run again but in the new
      location and so on.
      Do you know how ?

      many thanks.
      best regards.

        • 1. Re: Control film loop
          James Newton, ACP Level 3
          Select the filmLoop. In the Property Inspector at the Film Loop tag, remove the check mark from the Loop box.

          Suppose your filmLoop sprite is in channel 1:

          on mouseUp()
          vSprite = sprite(1) -- HARD-CODED

          -- Check if the filmLoop has finished playing
          tell vSprite
          vFinished = (the frame = the lastFrame)
          end tell

          if not vFinished then
          -- The filmLoop has not played to the end
          end if

          -- If we get here, the filmLoop has played to the end. Move it to
          -- a new place, and play it again.
          vLoc = randomLoc() -- use the point you want to move the filmLoop to
          vMember = vSprite.member
          vMember.loop = FALSE
          vSprite.loc = vLoc

          on randomLoc() -- temporary handler for testing purposes
          vRect = (the stage).rect
          vRandomH = random(vRect.width)
          vRandomV = random(vRect.height)
          return point(vRandomH, vRandomV)