4 Replies Latest reply on Mar 17, 2014 3:43 PM by Amy Blankenship

    Why is my FPS inconsistent?

    ARMANiFiED

      God bless, I'm pretty new at Flash so please bear with me; so I am having trouble with an annimation that I initially made on pivot animator and then exported and copied onto Flash. I noticed that when I playback the annimation it is slow and when I try to change the FPS it is not consistent, meaning it changes by itself, for example I put it to the fastest it would go(120 FPS) and I saw it changing as the aninmation played: 9.21 FPS, 8.30 FPS, 10.12 FPS, every frame. Please someone explain what I should do. Thanks.

        • 1. Re: Why is my FPS inconsistent?
          kglad Adobe Community Professional & MVP

          there's no simple one-step fixes all advice you can be given.  and it's even possible that your animation is so complex that nothing can be done to improve the fps you're seeing.

           

          that said, here is an excerpt from a book i wrote (Flash Game Development) and are the things that help increase fps:

           

          Easiest to Hardest to Implement

          1. Do not use Filters.
          2. Always use reverse for-loops and avoid do-loops and avoid while-loops.
          3. Explicitly stop Timers to ready them for gc (garbage collection).
          4. Use weak event listeners and remove listeners.
          5. Strictly type variables whenever possible.
          6. Explicitly disable mouse interactivity when mouse interactivity not needed.
          7. Replace dispatchEvents with callback functions whenever possible.
          8. Stop Sounds to enable Sounds and SoundChannels to be gc'd.
          9. Use the most basic DisplayObject needed.
          10. Always use cacheAsBitmap and cacheAsBitmapMatrix with air apps (i.e., mobile devices).
          11. Reuse Objects whenever possible.
          12. Event.ENTER_FRAME loops: Use different listeners and different listener functions applied to as few DisplayObjects as possible.
          13. Pool Objects instead of creating and gc'ing Objects.
          14. Use partial blitting.
          15. Use stage blitting.
          16. Use Stage3D.

           

          Greatest to Least Benefit

          1. Use stage blitting (if there is enough system memory).
          2. Use Stage3D.
          3. Use partial blitting.
          4. Use cacheAsBitmap and cacheAsBitmapMatrix with mobile devices.
          5. Explicitly disable mouse interactivity when mouse interactivity not needed.
          6. Do not use Filters.
          7. Use the most basic DisplayObject needed.
          8. Reuse Objects whenever possible.
          9. Event.ENTER_FRAME loops: Use different listeners and different listener functions applied to as few DisplayObjects as possible.
          10. Use reverse for-loops and avoid do-loops and while-loops.
          11. Pool Objects instead of creating and gc'ing Objects.
          12. Strictly type variables whenever possible.
          13. Use weak event listeners and remove listeners.
          14. Replace dispatchEvents with callback functions whenever possible.
          15. Explicitly stop Timers to ready for gc.

          16. Stop Sounds to enable Sounds and SoundChannels to be gc'd.

          1 person found this helpful
          • 2. Re: Why is my FPS inconsistent?
            kristofer Level 2

            Alternatively, you can just add audio to your timeline.  Any audio will do (it can even be an audio track of silence).  Then when Flash plays back your animation it will drop frames for playback so that the audio plays normally and your frame rate will play at your desired rate.  The more complex the animation the more frames flash will drop during playback.  Even though Flash is dropping frames, it still helps you to see what your motion will look like.

            • 3. Re: Why is my FPS inconsistent?
              chris georgenes Level 2

              This is an old school trick that works but make sure the audio is set to "Stream".

              • 4. Re: Why is my FPS inconsistent?
                Amy Blankenship Level 4

                Just be aware that if the playhead skips over any MovieClips that have a streaming sound on frame one, the movieclip will be partially created in such a way that you have no control over it and can't get control over it. The sound will play, and you will not be able to stop it. The solution is to write a parallel function like goToAndStop/goToAndPlay that briefly visits all frame labels on the way to the one you are really aiming for. Or to not start streaming sounds on frame 1 of nested clips (but this only solves it sometimes).