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

GUI > RefreshIcon

start ... mouse up
stop ... mouse down 

	RefreshIcon
	+ start()
	+ stop()
	+ reset()
Get Adobe Flash player
by 110100110101101 12 Jun 2016
    Embed
/**
 * Copyright 110100110101101 ( http://wonderfl.net/user/110100110101101 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/istd
 */

/**
    RefreshIcon
    + start()
    + stop()
    + reset()
*/

package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            stage.frameRate = 60
            stage.addEventListener( MouseEvent.MOUSE_DOWN, mouseDownHandler )
            stage.addEventListener( MouseEvent.MOUSE_UP, mouseUpHandler )
            
            icon = new RefreshCirclesIcon()
            icon.x = 225
            icon.y = 225
            icon.scaleX = 1
            icon.scaleY = 1
            
            addChild( icon )
        }
        private var icon:RefreshCirclesIcon
        public function mouseDownHandler(event:MouseEvent):void
        {
            icon.stop()
        }
        public function mouseUpHandler(event:MouseEvent):void
        {
            icon.start()
        }

    }
}   
    
    
        
            
            
            
            
                        
        
    
    import flash.display.Sprite
    import flash.display.Shape
    import flash.events.TimerEvent
    import flash.utils.Timer
    class RefreshCirclesIcon
    extends Sprite
    {
        public function RefreshCirclesIcon()
        {
            super();
            var radius:Number
            var radian:Number
            
            radius = 10
            
            var iMax:int = 7
            for( var i:int = 0; i <= iMax; ++i )
            {
                var shape:Shape;
                shape = new Shape();
                shape.graphics.beginFill( color );
                shape.graphics.drawCircle( 10, 0, 3 );
                shape.graphics.endFill()
                
                //radian = ( i * ( 5.5 / iMax ) )
                //shape.rotation = radian
                shape.rotation = i * ( 360 / ( iMax + 1 ) )
                //shape.y = Math.sin( radian ) * radius;
                //shape.x = Math.cos( radian ) * radius;
                pipList[pipList.length] = shape
                addChild( shape )
            }
            
            timer = new Timer( 100 )
            timer.addEventListener( TimerEvent.TIMER, timerTickHandler )
            timer.start()
        }
        public var color:uint = 0x9090F0
        private var pipList:Array = []
        private var prevIndex_7:int = 0
        private var prevIndex_6:int = 0
        private var prevIndex_5:int = 0
        private var prevIndex_4:int = 0
        private var prevIndex_3:int = 0
        private var prevIndex_2:int = 0
        private var prevIndex_1:int = 0
        private var prevIndex_0:int = 0
        private var started:Boolean = false
        private var timer:Timer
        private function timerTickHandler( event:TimerEvent ):void
        {
            update()
        }
        public function update():void
        {
            pipList[prevIndex_7].scaleY = 0.3
            pipList[prevIndex_6].scaleY = 0.5
            pipList[prevIndex_5].scaleY = 0.7
            pipList[prevIndex_4].scaleY = 1
            pipList[prevIndex_3].scaleY = 0.7
            pipList[prevIndex_2].scaleY = 0.5
            pipList[prevIndex_1].scaleY = 0.3
            pipList[prevIndex_0].scaleY = 0.1
            prevIndex_7 = prevIndex_6
            prevIndex_6 = prevIndex_5
            prevIndex_5 = prevIndex_4
            prevIndex_4 = prevIndex_3
            prevIndex_3 = prevIndex_2
            prevIndex_2 = prevIndex_1
            prevIndex_1 = prevIndex_0
            ++prevIndex_0
            if( 7 < prevIndex_0 ){ prevIndex_0 = 0 }
        }
        public function start():void
        {
            timer.start()
        }
        public function stop():void
        {
            timer.stop()
            reset()
        }
        public function reset():void
        {
            timer.reset()
            var iMax:int = pipList.length - 1
            for( var i:int = 0; i <= iMax; ++i )
            {
                pipList[i].scaleY = 0.3
            }
        }
    }