7 Replies Latest reply on Apr 27, 2011 8:33 AM by Production Monkey

    Pausing a filmloop without pausing the entire movie????


      I have been searching the user forum in order to find a solution of how to pause a film loop, but either the solution is not there or I can't find it. Most proposed ways makes everything stop.

      I found out how to check for current frame by setting film_loop = sprite(x).movie and then Currentframe = film_loop.frame. But when I try to use film_loop.frame = (Current-1)  everything stops, not just the sprite containing the filmloop. If this is really not possible in Director I'd like to know that too, so I can spend my time on something else....


        • 1. Re: Pausing a filmloop without pausing the entire movie????
          James Newton, ACP Level 3

          Filmloops are designed to play either from beginning to end or as a repeating loop. There are ways to detect when a filmloop reaches a particular frame, and there are ways to replace a filmloop with a static image. These techniques could be used to give the impression that the filmloop has halted at a particular frame. However, this solution would not give you a way to restart the filmloop from the paused position.


          I suggest that you tell us more about the contents of the filmloop and the circumstances in which it needs to be paused. We may be able to suggest other ways of achieving the same functionality. One possiblity would be to create each filmloop as a separate Director movie, and import it as a #movie member, or LDM (Linked Director Movie). This will give you more control over playback of the sequence.

          • 2. Re: Pausing a filmloop without pausing the entire movie????
            KariHovda Level 1

            thanks, it seems I was right to worry about this not being possible, then... I make a quite simple part of a game for children. A person is running in the left part of the screen (running "on the spot") - while  some stones and trees in the background are moving from right to left so that it seems the person is moving from left to right...(The filmloop contains these bacground things).

            In the right end of the screen different figures will pop up, and the person should stop (which means the background must stop too) -  The figures that show up are animated so the whole movie cannot stop.  The player will help the character deal with these creatures in different ways and when he gets rid of it the character will continue running and the landscape in the background should start moving again.  I really can't believe there is not a very easy way to do this since it's such a standard game design..

            • 3. Re: Pausing a filmloop without pausing the entire movie????
              Production Monkey Level 3

              Pausing a Filmloop that is set to "loop" is easy enough.


              Here's a behavior I just wrote up and tested. Drop it on any Filmloop you want to pause. You can then call pause() or play() on the sprite to pause or play it.


              i.e. Lets say sprite(5) is my filmloop then in the message window you would write:







              -- Filmloop Pause behavior

              property  pMovie  -- FilmLoop reference
              property  pPaused  -- boolean. currently paused? true false
              property  pPauseOnFrame  -- frame in filmloop to pause on

              on beginSprite me
                pMovie = sprite(me.spriteNum).movie
                pPaused = false

              on pause me
                pPaused = true
                pPauseOnFrame = pMovie.frame

              on play me
                pPaused = false

              on exitFrame me
                if  Not pPaused then exit

              • 4. Re: Pausing a filmloop without pausing the entire movie????
                KariHovda Level 1

                Sorry, - this stops the entire movie, - I just want the actual sprite to stop, not other animations on the screen.

                (I copied your code into a behavior script, then dropped it on my sprite containig the filmloop)


                But I just tried to import the loop as a separate Director movie, and that worked fine, - only the actual sprite stopped.

                The code is like this:


                CurrentStop = sprite(5).movie.frame


                • 5. Re: Pausing a filmloop without pausing the entire movie????
                  Production Monkey Level 3

                  Interesting..... because it works for me.



                  I did some experiments and it seems the code works for me because I use a Framescript to loop on  a single frame and that keeps the stage updated. If I remove that script, then the playhead stops and of course all of the animations also stop.


                  I suggest using linked Director movies rather than importing them. It will enable you to modularize your assets and you can include scripts and behaviors in you LDMs. You can buld all the action sequences for a character inside a single LDM. The LDM can then provide a simple interface for playing back each sequence.






                  You create the interface inside the LDM using a Movie script.


                  on walk




                  on jump





                  • 6. Re: Pausing a filmloop without pausing the entire movie????
                    KariHovda Level 1

                    Interesting, I tried the same here, and as you say it works if you loop on a single frame. Too bad , - this must be a bug, it doesn't really make sense.


                    I import the movie as a linked cast member, - isn't that the same as LDM? (probably a stupid question, but anyway..)


                    So far most of my animations are filmloops which I'm perfectly happy with, - it's simple to just change the content of the actual sprite to whatever animation I need. - But I really needed the background animation to be able to pause wherever I want it to, so filmloops weren't good enough for that one.


                    Anyway, thanks a lot for the help, I'll keep in mind these possibilites if I make a bigger project later. But aren't there some issues with memory leaks and LDMs?


                    (It seems that quite often when you are stuck in Director, there is no real answer, just ways to get around the problem, -- and probably noone will ever fix these things either, too bad.)

                    • 7. Re: Pausing a filmloop without pausing the entire movie????
                      Production Monkey Level 3

                      I agree that it is a bug. And, I would guess it has been present since filmloops were first added.


                      All development environments have bugs and quirks. And if you have a solid work around such as using linked Director movies - LDMs, or Lingo to loop on a frame or move a background programmatically, then that is fine with me. I would call those solutions real answers.