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

Rotation math

Get Adobe Flash player
by Good 25 Sep 2012
/**
 * Copyright Good ( http://wonderfl.net/user/Good )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/uGKy
 */

// forked from makc3d's Clock
package  {
    import flash.text.TextFormat;
    import flash.text.TextField;
    import flash.display.Sprite;
    import flash.events.Event;
    import com.bit101.components.Label;
    [SWF (width=465, height=465)]
    public class Clock extends Sprite {
        public function Clock () {
            super (); 
            x = y = 465 / 2; 
            //rotation = -90;

            var lable:Label = new Label();
            addChild(lable);
            lable.text = 'zzz';
            lable.x=-200;
                    
                    
            var tf:TextField = new TextField();
            tf.autoSize = 'left';
            tf.x = tf.y = -200;
            addChild(tf);
            tf.defaultTextFormat = new TextFormat('arial', 11, 0x333333, true);
            
            
            var a:int=0, r:Number=2;
            addEventListener (Event.ENTER_FRAME, function (e:Event):void {
                
                r+=.06;
                a += a<360 ? 3 : -360;
                var rad:Number = a * Math.PI / 180;
               // graphics.clear (); 
                graphics.lineStyle (2);
                graphics.lineTo (r * Math.cos (rad), r * Math.sin (rad)); 
                //graphics.moveTo (0, 0);
                
                tf.text = a+'\n'+rad;
            });
        }

    }
}