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

ローディングしてwipeで表示

Get Adobe Flash player
by nsmt 02 May 2009
package {
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.display.Loader;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.*;
	
    import fl.transitions.*;
    import fl.transitions.easing.*;
    
    public class FlashTest extends Sprite {
        
        var loadingBar:Sprite;
	var loadingContainer:Loader;
	var holder:MovieClip;
        
        public function FlashTest() {
            init();  
        }
        
        private function init():void {
			
			loadingBar = new Sprite;
			loadingBar.graphics.beginFill(Math.random()* 0xffffff);
			loadingBar.graphics.drawRect(0, 0, 1, 6);
			loadingBar.graphics.endFill();
			
			holder = new MovieClip();
			holder.graphics.beginFill(0xffffff);
			holder.graphics.drawRect(0, 0, 282, 280);
			holder.graphics.endFill();
			holder.x = stage.stageWidth/2-141;
			holder.y = stage.stageHeight/2-140;
			
			
			loadingContainer = new Loader();
			loadingContainer.load(new URLRequest("http://farm4.static.flickr.com/3588/3461824359_8847dcf5bf_o.jpg"));
			loadingContainer.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProg);
			loadingContainer.contentLoaderInfo.addEventListener(Event.COMPLETE, onComp);
		}
		
		private function onProg(event:ProgressEvent):void {
			
			addChild(loadingBar);
			loadingBar.scaleX = event.bytesLoaded/event.bytesTotal*stage.stageWidth;
		}
		
		private function onComp(event:Event):void {
		
			removeChild(loadingBar);
			
			addChild(holder);
			holder.addChild(loadingContainer);
			TransitionManager.start(holder, {type:Wipe, direction:Transition.IN, duration:0.4, easing:None.easeNone, startPoint:1});

		}
    }
}