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

シーン遷移(?)

クリックで表示するシーン変更

http://flash-scope.com/scene_change_with_function_call.html
Get Adobe Flash player
by osamX 04 Feb 2011
/**
 * Copyright osamX ( http://wonderfl.net/user/osamX )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/soc5
 */

package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class Main extends Sprite 
	{
		
		public function Main():void {
			changeScene();
		}
		
		private function changeScene():void {
			var scene:Scene = new Scene(changeScene, 0xFFFFFF * Math.random());
			addChild(scene);
		}
	}
	
}


import flash.display.Sprite;
import flash.events.MouseEvent;

class Scene extends Sprite {
	private var finishScene:Function;
	
	public function Scene(f:Function, c:uint):void {
		finishScene = f;
		graphics.beginFill(c);
		graphics.drawRect(0, 0, 465, 465);
		graphics.endFill();
		
		addEventListener(MouseEvent.CLICK, onClick);
	}
	
	private function onClick(e:MouseEvent):void {
		removeEventListener(MouseEvent.CLICK, onClick);
		parent.removeChild(this);
		finishScene.call(this);
		finishScene = null;
	}
}