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

つくりちゅー

何作るか未定。いや、だいたい決めてるけどお楽しみ。
こーどぐっちゃぐちゃ
ちょっと休憩。MPが不足。
Get Adobe Flash player
by maxcaffy 30 Apr 2010
/**
 * Copyright maxcaffy ( http://wonderfl.net/user/maxcaffy )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/lOKK
 */

//何作るか未定。いや、だいたい決めてるけどお楽しみ。
//こーどぐっちゃぐちゃ

//ちょっと休憩。MPが不足。

package {
	import flash.text.TextField;
    import flash.display.Sprite;
    import flash.system.LoaderContext;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.display.BitmapData;
    
    import flash.events.Event;
    import flash.events.MouseEvent;
    public class FlashTest extends Sprite {
    		private var _crash:Crash;
    		private var _trace:TraceSet;
    		private var _char:Char;
    		private var _field:Field;
    		private var _flag_click:Boolean;
    		
        public function FlashTest():void {
        		_initFunc();
        }       
        
        private function _initFunc():void{
        	
        		global.stage = stage;

        		_field = new Field();
            stage.addChild(_field);
            
        	    _char = new Char();
        	    with(_char){
        	    		x = global.stage.stageWidth/2;
        	    		y = global.stage.stageHeight/2;
        	    }
            stage.addChild(_char);
            
        		_crash = new Crash();
            
            _flag_click == false

            stage.addEventListener(Event.ENTER_FRAME,_entFunc);
            stage.addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown);
        }
        
        private function _entFunc(event:Event):void{
        		if(_flag_click == false){
	        		with(_char){
	        			x += (stage.mouseX - x)*0.1;
	        			y += (stage.mouseY - y)*0.1;	
	        		}
        		}else{
        			_char.z += 500;
        			if(_char.z > 5000){
        				stage.removeEventListener(Event.ENTER_FRAME,_entFunc);
        				//stage.removeChild(_char);
        				stage.addChild(_crash);
        				stage.addChild(_char);
        				with(_crash){
        					x = _char.x;
        					y = _char.y;
        					z = _char.z;
        				}
        			}
        		}
        	}
        	private function _mouseDown(event:MouseEvent):void{
        		stage.removeEventListener(MouseEvent.MOUSE_DOWN,_mouseDown);
        		_flag_click = true;
        	}
        	
        	private function _resetFunc(event:MouseEvent):void{
        		
        		
        	}   	
    }
}

/*///////////////////////////////////////////////////////
//ひび割れ用クラス
///////////////////////////////////////////////////////*/

import flash.display.Sprite; 
import flash.display.Graphics;
import flash.geom.Point;
import flash.utils.Proxy;
class Crash extends Sprite{
	
	private var _line_arr:Array = new Array();
	private const _LINE_NUM:int = 20;		//亀裂の数
	private const _LINE_LENGTH:int = 50;	//亀裂の長さ
	private const _LINE_LEVEL:int = 3;
	private var _g:Graphics = graphics;
	private var _i:int = 0;
	private var _k:int = 0;

	public function Crash():void{
		
		_initFunc();
		_g.moveTo(0,0);
		
		for(_k = 0;_k < _LINE_LEVEL;_k++){
			for(_i = 0;_i < _LINE_NUM;_i++){
				_g.moveTo(_line_arr[_i][2].x,_line_arr[_i][2].y);
				_line_arr[_i][0] = (Math.PI*2/_LINE_NUM) * _i * (1 + (Math.random()*0.05 - 0.025));								//ランダム角度
				_line_arr[_i][1] = (_k + 1) * _LINE_LENGTH * (1 + Math.random()*0.2 + 0.1);
				_line_arr[_i][2] = new Point(_line_arr[_i][1] * Math.cos(_line_arr[_i][0]) , _line_arr[_i][1] * Math.sin(_line_arr[_i][0]));
				_g.lineTo(_line_arr[_i][2].x,_line_arr[_i][2].y);
			}
			for(_i = 0; _i < _LINE_NUM;_i++){
				_g.lineTo(_line_arr[_i][2].x,_line_arr[_i][2].y);
			}
		}
		
		for(_i = 0;_i < _LINE_NUM;_i++){
			_g.moveTo(_line_arr[_i][2].x,_line_arr[_i][2].y);
			_line_arr[_i][0] = (Math.PI*2/_LINE_NUM) * _i //* (1 + (Math.random()*0.05 - 0.025));								//ランダム角度
			_line_arr[_i][1] = (_LINE_LEVEL + 1) * _LINE_LENGTH * (1 + Math.random());
			_line_arr[_i][2] = new Point(_line_arr[_i][1] * Math.cos(_line_arr[_i][0]) , _line_arr[_i][1] * Math.sin(_line_arr[_i][0]));
			_g.lineTo(_line_arr[_i][2].x,_line_arr[_i][2].y);
			
			if(Math.random()<0.1){
				_k ++;
				var temp:Point = new Point(_line_arr[_i][2].x,_line_arr[_i][2].y);
				_g.moveTo(_line_arr[_i][2].x,_line_arr[_i][2].y);
				_line_arr[_i][0] = (Math.PI*2/_LINE_NUM) * _i * (1 + (Math.random()*0.05 - 0.025));								//ランダム角度
				_line_arr[_i][1] = (_LINE_LEVEL + _k + 1) * _LINE_LENGTH * (1 + Math.random()*0.1);
				_line_arr[_i][2] = new Point(_line_arr[_i][1] * Math.cos(_line_arr[_i][0]) , _line_arr[_i][1] * Math.sin(_line_arr[_i][0]));
				_g.lineTo(_line_arr[_i][2].x,_line_arr[_i][2].y);
				
				/*if(Math.random()<0.9){
					_g.moveTo(temp.x,temp.y);
					_line_arr[_i][0] = (Math.PI*2/_LINE_NUM) * _i * (1 + (Math.random()*0.1 - 0.05));								//ランダム角度
					_line_arr[_i][1] = (_LINE_LEVEL + _k + 1) * _LINE_LENGTH * (1 + Math.random()*0.5);
					_line_arr[_i][2] = new Point(_line_arr[_i][1] * Math.cos(_line_arr[_i][0]) , _line_arr[_i][1] * Math.sin(_line_arr[_i][0]));
					_g.lineTo(_line_arr[_i][2].x,_line_arr[_i][2].y);
				}*/
			}
		}
	}
	
	private function _initFunc():void{
		_g.lineStyle(10,0x000000,1.0);
		for(_i = 0;_i<_LINE_NUM;_i++){
			_line_arr[_i] = [0,0];
			_line_arr[_i][0] = 0;
			_line_arr[_i][1] = 0;
			_line_arr[_i][2] = new Point(0,0);
		}
	}
}

/*///////////////////////////////////////////////////////
//キャラ用クラス
///////////////////////////////////////////////////////*/

import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.system.LoaderContext;
import flash.geom.Rectangle;
import flash.display.Sprite;
class Char extends Sprite{
	
	private var _bmd:BitmapData;
	//private var _bmd_set:BitmapData;
	private var _bm:Bitmap;
	
	public function Char():void{
		_loadFunc();
	}
	
    private function _loadFunc():void{		
    		var loader:Loader = new Loader();
    		loader.contentLoaderInfo.addEventListener(Event.COMPLETE,_loadComp);
    		loader.load(
    			new URLRequest("http://assets.wonderfl.net/images/related_images/1/10/105f/105fdbfa302a5dbe07350065764af7a4dd60ddf7"),
   			new LoaderContext(true)
    		);
   }
        
   private function _loadComp(event:Event):void{
   	   	_bmd = Bitmap(Loader(event.currentTarget.loader).content).bitmapData;
   		_bm = new Bitmap(_bmd);
   		addChild(_bm);
   		_bm.x -= _bm.width/2;
   		_bm.y -= _bm.height/2;
//   		var _p:Point = new Point(width/2,height/2);
//   		var _r:Rectangle = new Rectangle()/
//		_bmd_set = new BitmapData(width,height,true,0x000000,null,null,true);
//   	   	_bmd_set.copyPixels(_bmd , new Rectangle(width,height) , new Point(width/2,height/2) , null , null , true);
//    		this.bitmapData = _bmd_set;
   }
}

/*///////////////////////////////////////////////////////
//フィールド用クラス
///////////////////////////////////////////////////////*/

import flash.display.Shape;
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.Stage;
class Field extends Shape{
	private var _g:Graphics = graphics;
	private const _OFFSET:int = 100;
	public function Field():void{
		_g.lineStyle(1.0,0x000000,1.0);
		_g.moveTo(0,0);
		_g.lineTo(_OFFSET,_OFFSET);
		_g.moveTo(global.stage.stageWidth,	0);
		_g.lineTo(global.stage.stageWidth-_OFFSET,_OFFSET);
		_g.moveTo(0,								global.stage.stageHeight);
		_g.lineTo(_OFFSET,						global.stage.stageHeight - _OFFSET);
		_g.moveTo(global.stage.stageWidth,		global.stage.stageHeight);
		_g.lineTo(global.stage.stageWidth - _OFFSET,	global.stage.stageHeight - _OFFSET);
		_g.drawRect(0,0,	global.stage.stageWidth,global.stage.stageHeight);
		_g.drawRect(_OFFSET,_OFFSET,global.stage.stageWidth - _OFFSET*2,global.stage.stageHeight - _OFFSET*2);
	}
}

class global{
	public static var stage:Object;
}

/*///////////////////////////////////////////////////////
//トレース用クラス
///////////////////////////////////////////////////////*/

import flash.text.TextField;
import flash.display.Sprite;

class TraceSet extends TextField{

	public function TraceSet(){
//		this.selectable = false;
		this.textColor = 0x666666;
		trace("started");
	}
	
	public function trace(t:String):void{
		this.text = t;
	}
}