2 Replies Latest reply on Apr 17, 2008 9:56 AM by Maarten Sander

    Rotating an SWFLoader

    Maarten Sander
      Hi, I'm trying write a simple wrapper application that loads an existing movieclip, and rotates it 90, 180 or 270 degrees. I've tried using both the rotation property and the rotate effect, but both have their problems.

      When I try to use the rotation property, the loaded movieclip is placed outside the screen, since the movie rotates around (0, 0). I've tried moving both the SWFLoader and the movieclip down, but it didn't have any effect.

      I've also tried to use the rotate effect (see attached code for my latest effort), and at first glance it seems allright, but it still doesn't work as expected: the movieclip is clipped (looks like there's a mask with the original dimensions of the movie), and resizing or scrolling causes the movieclip to disappear.

      Does anyone know how to solve this issue? Is there a better way to create this wrapper? Should I use the SWFLoader at all?
        • 1. Re: Rotating an SWFLoader
          slaingod Level 1
          You can achieve a 'center rotation' effect by placing your SWFLoaded object inside a Canvas, then setting the SWFLoader's x and y to -(width/2) and -(height/2) so that the canvas's upper left is in the middle of your swf. You then apply your rotation to the canvas instead. Disable clipping on the canvas obviously. You can basically use this technical for rotation around an arbitrary point.

          There are other examples out there for doing this with Matrix transforms.
          • 2. Re: Rotating an SWFLoader
            Maarten Sander Level 1
            Thanks for your answer. I couldn't get things to work the way you described it, and I also didn't want to rotate around the center :-) I wanted to rotate the movie, and keep it in the top left corner. I should have been more clear about what I was trying to do.

            However, your tips did give me a proper starting point, thank you! See the attached code for my final solution.