4 Replies Latest reply on Oct 24, 2011 11:45 PM by unitymix

    URGENT - How to make a film advance frame by frame

    unitymix

      Hi,

       

      I have about 2 minutes of real life footage.

       

      I need to put this in a "flash container" and make it advance frame by frame every time the UP key is pressed.

       

      The faster the UP key is pressed, the faster the film should advance.

       

      Accelleration and decelleration should seem "natural" (not bumpy and sudden).

       

      Very Urgent - Can anybody help please ????? (happy to pay a beer or two LOL )

       

      Many thanks

       

      (using CS5)

        • 1. Re: URGENT - How to make a film advance frame by frame
          kglad Adobe Community Professional & MVP

          if the up key is pressed once, how many frames should advance and at what rate?  if the up key is pressed twice, how many frames should advance and at what rate?

          • 2. Re: URGENT - How to make a film advance frame by frame
            unitymix Level 1

            Hi kglad,

             

            This is a little complicated so I will explain properly.

             

            This will be used on proprietry hardware mainly by elderly persons and young kids.

             

            The "Up Key" is a keystoke emulation in that proprietry hardware (e.g. it is not a normal keyboard).

             

            A single stoke keeps the UP key pressed for 150ms before repeating. This means that holding down the key for 1 second will equate to about 6 key strokes.

             

            The idea is that we should get up to a smooth framerate (whatever that happens to be without being "jerky") in about 5 seconds.

             

            When the UP button is released, framerate should slow down by a simliar amount and come to a nautural, smooth stop (gravity).

             

            It would be useful to have a sort of .ini file in this for tests, so accelleration and decelleration can be tested and tweaked before being hardcoded.

             

            As stated previously - this is very urgent. Any help would be very welcome...

             

            Many Thanks.

            • 3. Re: URGENT - How to make a film advance frame by frame
              kglad Adobe Community Professional & MVP

              any frame rate less than 12 is likely to look jerky.  even a frame rate of 20 may look jerky to critical observers.  you need to experiment to find the minimal acceptable frame rate. 

               

              there's also a max frame rate that you'll need to determine by experimentation.  once you have those two parameters and the length of time (apparently 5 seconds) to for your emulator to trigger a change from the min to the max frame rate, you can use:

               

              var minFR:int=12;  // min frame rate

              var maxFR:int=60;  // max frame rate

              var increaseDuration:int=5; // seconds to transition from minFR to maxFR

              var decreaseDuration:int=1;  // seconds to transition from maxFR to minFR

               

              var playDelay:Number = minFR;

               

              emulator.addEventListener(KeyboardEvent.KEY_DOWN,downF);

               

              emulator.addEventListener(KeyboardEvent.KEY_UP,upF);

               

              var playT:Timer=new Timer(1000/minFR);

              var slowT:Timer=new Timer(1000/150,slowF);

               

              playT.addEventListener(TimerEvent.TIMER,playF);

              slowT.addEventListener(TimerEvent.TIMER,slowF);

               

              function downF(e:KeyEvent):void {

              if (playT.running) {

              playDelay = playDelay+(maxFR-minFR)*(150/1000)/increaseDuration;

              playT.delay=Math.min(maxFR/1000,playDelay);

              } else {

              playT.delay=minFR;

              playT.start();

              }

              }

               

              function upF(e:KeyboardEvent):void{

              slowT.start();

              slowF(null);

              }

              function slowF(e:TimerEvent):void{

              playDelay = maxFR-(maxFR-playDelay)*(150/1000)/decreaseDuration;

              playT.delay = Math.max(minFR,playDelay);

              if(playDelay<=minFR){

              slowT.stop();

              playT.stop();

              }

              }

              function playF(e:TimerEvent):void{

              yourmovieclip.nextFrame();

              if(yourmovieclip.currentFrame==yourmovieclip.totalFrames){

              playT.stop();

              slowT.stop();

              }

              }

              1 person found this helpful
              • 4. Re: URGENT - How to make a film advance frame by frame
                unitymix Level 1

                Many, many thanks Kglad.

                 

                This looks asthough it should do the trick. I'll report back when I've tried it.