Siple rotation control

by jokehn9
♥0 | Line 21 | Modified 2012-09-04 10:33:40 | MIT License
play

ActionScript3 source code

/**
 * Copyright jokehn9 ( http://wonderfl.net/user/jokehn9 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/5sGR
 */

package {
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var test_rect:Sprite = new Sprite();
            test_rect.graphics.beginFill(0xff0000);
            test_rect.graphics.drawRect(-50,-100,100,200);
            addChild(test_rect);
            test_rect.x = 200;
            test_rect.y = 200;
            addEventListener("enterFrame", rotation_ent);
            function rotation_ent(e:Event):void {
                if(mouseX > 0 && mouseX< 475 && mouseY> 0 && mouseY <475) {
                   test_rect.rotationY += (mouseX - test_rect.x)/20;
                    test_rect.rotationX += (mouseY - test_rect.y)/20;
                }

                
            }

            
        }
    }
}