3 Replies Latest reply on Jan 5, 2008 7:58 AM by clbeech

    problems with _rotation

    Prosaunoja
      Hi! I'm new with flash and i'm having trouble with this _rotation tag. I'm trying to rotate image when user press either left or right keys but when that happens the whole program slows down about a half speed. Why is this happening? My code is here:
        • 1. Re: problems with _rotation
          Greg Dove Level 4
          I presume in your code its really:

          setInterval(rotate, 10);

          instead of
          setInterval(liike, 10);

          rotation and scaling are much more CPU intensive than translating, particularly for an object that contains a bitmap (and particularly for larger bitmaps). If you are running the setInterval code at 10 msec intervals like that, then - in theory - you are requesting potential updates at 100 frames per second. It seems unreasonably high and in practice I don't think it will achieve anything like that.
          • 2. Re: problems with _rotation
            Prosaunoja Level 1
            ok thanks for that!
            • 3. Re: problems with _rotation
              clbeech Level 3
              right gwd! the interval rate is far to high, it's generally not a good idea to run intervals faster than the current frame rate, when it effects graphic elements, even when calling updateAfterEvent, which will force the screen to redraw.

              Additionally, Prosaunoja you may be able to achieve this effect by a simpler structure without the looping interval, by using the Tween class, as below: