9 Replies Latest reply on Sep 2, 2007 2:21 PM by kglad

    Bad performance using scale?

    -_Zapp_-
      Hi all!

      I'm trying to make a small game in Flash using ActionScript 3. On the scene there is a movieclip that can be moved around with the arrow keyes. Its also possible to zoom in and out. I use scaleX and scaleY for this.

      The problen is that the more I zoom in (scale up my movieclip) the slower it gets. Finally the cpu is 100% and it moves and scales very slow. If I zoom out again everything is back to normal.

      Why? Have I missed some trick? How to get around this problem?

      Tanks for any help!
        • 1. Re: Bad performance using scale?
          kglad Adobe Community Professional & MVP
          enable the cacheAsBitmap property of your movieclip when scaling is completed and disable it when you're scaling.
          • 2. Re: Bad performance using scale?
            -_Zapp_- Level 1
            Thanks but this does not help. I have tried both with and without cache. The thing is that I use scaling (zoom) as much as move x and y. The stage is made to look 3D and I use scale to move close to an object. So it makes no sense turn cache on and off since I almost continusly use scale... and it does not help...

            But to me i seems like flash is rendering a huge picture (when I scale up much) and then only shows the small part that is visible on the stage (flash window)... If I zoom out much I get very good preformance! (I have no bitmaps in my movieclip it's pure vektor graphics)

            I would like to make my small game avalible for test here - but it seems not possible in this forum...
            • 3. Re: Bad performance using scale?
              kglad Adobe Community Professional & MVP
              flash must handle all objects whether they are on-stage or off-stage and whether the are visible or not visible.

              and there's no difference in the resources needed to handle on-stage visible objects, as there is to handle off-stage not visible objects.
              • 4. Re: Bad performance using scale?
                Robert Reinhardt Level 2
                Did you try to add a mask in ActionScript to your top-most sprite/child? If Flash Player only thinks it needs to render the stage area and not the work area outside of the stage, you might see better performance. (I know that masking graphics that appear behind Flash Video greatly improve video playback/performance...)

                HTH.
                • 5. Bad performance using scale?
                  -_Zapp_- Level 1
                  Ok kglad!

                  But then I don't understand how to make a relative fast interactive games. I'm new to this so I know you probably think I have made some beginners misstake that kills my preformance... that might be the case... but I think I maybe have designed the game wrong - maybe there is other ways of creating a simple 3D world to move around in other than using scale and move x y ?
                  • 6. Re: Bad performance using scale?
                    kglad Adobe Community Professional & MVP
                    try rr's suggestion to see if that helps in your situation before redoing your game.
                    • 7. Re: Bad performance using scale?
                      -_Zapp_- Level 1
                      Yes - I vill soon try rr's suggestion - hope it helps! - I have never used masks before so it will take some time...

                      But I also got an other suggestion that seems to do it:

                      If I remove my bevels (like 5 diffrent) it's no problem. I guess I have skip bevels. It's not to fun - the bevels kind of lift the animation to a nice 3D look. Maybe I can use bitmaps instead...

                      Thanks for all you help so far - relly appreciate it!
                      • 8. Re: Bad performance using scale?
                        -_Zapp_- Level 1
                        Ok - adding a mask was simple. If I did it correct... I just added a mask layer on the stage and put a rectangel there. But looking at rr's suggestion "...try to add a mask in ActionScript to your top-most sprite/child..." makes me wonder it there is some other way to do this...

                        Never the less it did not make any diffrence.
                        • 9. Re: Bad performance using scale?
                          kglad Adobe Community Professional & MVP
                          yes, you can use the setMask() method of movieclips to add a mask using actionscript.

                          using filters, especially for movieclips that are "animated", is cpu-intensive.