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

flash on 2009-03-18

Get Adobe Flash player
by awef 25 Mar 2009
/**
 * Copyright awef ( http://wonderfl.net/user/awef )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/kjmP
 */

package
{
    import flash.display.Sprite;
    
    public class main extends Sprite
    {
        function main()
        {
            stage.addChild(new clock(stage.stageWidth / 2, stage.stageHeight / 2, 128));
        }
    }
}

import flash.display.Sprite;
import flash.events.*;
import caurina.transitions.Tweener;

class clock extends Sprite
{
    private var obj:Sprite = new Sprite();
    private var r:uint;
    
    function clock(arg_x:int, arg_y:int, arg_r:uint)
    {
        x = arg_x;
        y = arg_y;
        r = arg_r;
        
        alpha = 0.5;
        
        var tmp:Sprite;
        
        tmp = new Sprite();
        tmp.graphics.lineStyle(2, 0x000000);
        tmp.graphics.drawCircle(0, 0, r);
        addChild(tmp);
        
        tmp = new Sprite();
        tmp.graphics.beginFill(0x000000);
        tmp.graphics.drawRect(0 - 1, 0, 2, -r / 10 * 9);
        tmp.graphics.endFill();
        tmp.name = "s";
        addChild(tmp);
        
        tmp = new Sprite();
        tmp.graphics.beginFill(0x000000);
        tmp.graphics.drawRect(0 - 2, 0, 4, -r / 10 * 9);
        tmp.graphics.endFill();
        tmp.name = "m";
        addChild(tmp);
        
        tmp = new Sprite();
        tmp.graphics.beginFill(0x000000);
        tmp.graphics.drawRect(0 - 2, 0, 4, -r / 10 * 8);
        tmp.graphics.endFill();
        tmp.name = "h";
        addChild(tmp);
        
        testa();
        testc();
        
        addEventListener(Event.ENTER_FRAME, frame);
    }
    
    private function frame(e:Event):void
    {
        var d:Date = new Date();
        getChildByName("s").rotationZ = d.seconds * 6;
        getChildByName("m").rotationZ = d.minutes * 6;
        getChildByName("h").rotationZ = d.hours % 12 * 30 + d.minutes / 2;
    }
    
    private function testa():void
    {
        Tweener.addTween(this, {rotationX:60, time:4, transition:"linear", onComplete:testb});
    }
    
    private function testb():void
    {
        Tweener.addTween(this, {rotationX:-60, time:4, transition:"linear", onComplete:testa});
    }
    
    private function testc():void
    {
        Tweener.addTween(this, {rotationY:60, time:3, transition:"linear", onComplete:testd});
    }
    
    private function testd():void
    {
        Tweener.addTween(this, {rotationY:-60, time:3, transition:"linear", onComplete:testc});
    }
}