In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

回転 5

Get Adobe Flash player
by Itikara 01 Feb 2010
    Embed
// forked from 回転 3
package {
    import flash.display.*;
    import flash.events.*;

    [SWF(width= 300, height= 300, frameRate= 30)]
    public class Test extends Sprite {
    		private var sp1:Sprite;
    		private var re1:Sprite;
    		private var sp2:Sprite;
    		private var re2:Sprite;
    		private var k:int = 0;
    		public function Test() {
        		graphics.beginFill(0xffcf7f);
        		graphics.drawRect(50, 50, 200, 200);

			sp1 = new Sprite();
			sp1.x = 150;
			sp1.y = 150;
			addChild(sp1);
        		re1 = new Sprite();
        		re1.graphics.beginFill(0xffffff);
        		re1.graphics.drawRect(-100, -100, 200, 200);
        		re1.graphics.endFill();
        		sp1.addChild(re1);

			sp2 = new Sprite();
			sp2.x = 150;
			sp2.y = 150;
			addChild(sp2);
        		re2 = new Sprite();
        		re2.graphics.beginFill(0xff7f00);
        		re2.graphics.drawRect(-100, -100, 200, 200);
        		re2.graphics.endFill();
        		sp2.addChild(re2);

            addEventListener(Event.ENTER_FRAME, rx);
        }
        
        private function rx(e:Event):void
        {
        		if (k <= 90 || k > 270)
        		{
        			sp2.visible = false;
        			sp1.rotationX = k;
        			sp1.visible = true;
        		}
        		else
        		{
        			sp1.visible = false;
        			sp2.rotationX = k;
        			sp2.visible = true;
        		}
        		k += 3;
        		if (k >= 360)
        		{
        			k = 0;
        		}
        }
    }
}