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

はこいりうさぎ

Get Adobe Flash player
by hacker_cobulht0 29 Mar 2010
    Embed
package {
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.*;
	import flash.geom.*;
	
	import caurina.transitions.Tweener; 
	
	[SWF(width = "465", height = "465", backgroundColor = 0xffffff, frameRate = "60")]
	
	public class Daughter_in_the_box_Puzzle extends Sprite{
		//readys
		private const baseX:uint=110;
		private const baseY:uint=80;
		
		private const _ReadyX:Array=[0,150,0,150,50,100,50,100,0,150,50];
		private const _ReadyY:Array=[0,0,100,100,100,100,150,150,200,200,0];
		private const movPower:uint=60;
		
		private var _BlockList:Array=new Array();
		
		//mains
		private var _Flags:Boolean=false;		
		private var myArray=[
									[99,99,99,99,99,99],
									[99,1,11,11,2,99],
									[99,1,11,11,2,99],
									[99,3,5,6,4,99],
									[99,3,7,8,4,99],
									[99,9,0,0,10,99],
									[99,99,99,99,99,99]
									];
		
		private var pressX:int;
		private var pressY:int;		
		private var pressBlock:MovieClip;
		
		public function Daughter_in_the_box_Puzzle(){if (stage) init();else addEventListener(Event.ADDED_TO_STAGE,init );}
		
		public function init(ev:Event = null){
			removeEventListener( Event.ADDED_TO_STAGE, init );
			var bg:back_ground=new back_ground();
			addChildAt(bg,0);
			readys();
		}		
		private function readys(){
			for (var j:uint=0; j < 11; j++) {			
			var mc:drawBlock=new drawBlock(j);
			mc.name="block"+j;
			mc.scaleX=mc.scaleY=1.2;
			mc.x=baseX+_ReadyX[j]*1.2;
			mc.y=baseY+_ReadyY[j]*1.2;
			_BlockList.push(mc);			
			addChild(mc);
			}			
			mains();
		}		
		private function mains(){
			for (var j:uint=0; j < 11; j++) {
				var mc:MovieClip=_BlockList[j];
				mc.addEventListener(MouseEvent.MOUSE_DOWN, funcPress);
				mc.addEventListener(MouseEvent.MOUSE_UP, funcRelease);
				stage.addEventListener(MouseEvent.MOUSE_UP, funcRelease);
			}
		}
		private function funcPress(ev){
			pressBlock=ev.target;
			pressX=mouseX;
			pressY=mouseY;
			_Flags=true;
		}
		private function funcRelease(ev){
			var nums:int=pressBlock.callNum;
			var releaseX:int=mouseX;
			var releaseY:int=mouseY;			
			var rpX:int= releaseX-pressX;
			var rpY:int= releaseY-pressY;
			var movX;
			var movY;
			if(Math.abs(rpX)>Math.abs(rpY)){
				movX=rpX / Math.abs(rpX);
				movY=0;
			}else if(Math.abs(rpX)<Math.abs(rpY)){
				movX=0;
				movY=rpY / Math.abs(rpY);
			}else if(Math.abs(rpX)==0&&Math.abs(rpY)==0){return;}
			var ck=funcMovs(nums,movY,movX);
			if(ck&&_Flags){	
				pressBlock.x=pressBlock.x +movX*movPower;
				pressBlock.y=pressBlock.y +movY*movPower;
				if(myArray[5][2]==11&&myArray[5][3]==11){funcGoal();}
				_Flags = false;	
			}
		}
		
		private function funcMovs(arg1:int,arg2:int,arg3:int){
			var arr2:Array=new Array();
			var ckStop:uint=0;
				for (var qy:uint=0; qy<7; qy++) {
					arr2[qy]=new Array();
					for (var qx:uint=0; qx<5; qx++) {
						if (myArray[qy][qx] == arg1+1){
							if(myArray[qy+arg2][qx+arg3]==0||myArray[qy+arg2][qx+arg3]==arg1+1){continue;}
							ckStop=10;
						}
					}
				}
				if (ckStop > 0) {return (false);} else{ 
					for (qy=0; qy<7; qy++) {
					for (qx=0; qx<5; qx++) {
						if (myArray[qy][qx] == arg1+1){
							if (arr2[qy][qx] != arg1+1){arr2[qy][qx] = 0;}             
							arr2[qy+arg2][qx+arg3] = arg1+1;
							continue;
							}
						if (arr2[qy][qx] == undefined){arr2[qy][qx] = myArray[qy][qx];}    
					} 
					}
					for (qy=0; qy <7;qy++) {
					for (qx=0; qx<5; qx++) {        
					myArray[qy][qx] = arr2[qy][qx];
					}
					}
					return (true);
				}
		}		
		
		private function funcGoal(){
			for(var j:int=0; j < _BlockList.length; j++){
				if(j<_BlockList.length-1){
					Tweener.addTween(_BlockList[j], {alpha:0,delay:1+j/10,time:1});
				}else{
					Tweener.addTween(_BlockList[j], {y:180,delay:1+j/10,time:2,onComplete:function(e){						
							var pic:goalPicture=new goalPicture();
							addChild(pic);
							pic.y=pic.scaleX=pic.scaleY=0;
							pic.x=100;
							Tweener.addTween(pic, {y:100,scaleX:1,scaleY:1,time:1});
					}});
				}
				
			}
		}
		
	}
}

//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

import flash.display.MovieClip;
import flash.display.Sprite;
import flash.filters.GlowFilter;
class drawBlock extends MovieClip{
	private const _ReadyW:Array=[50,50,50,50,50,50,50,50,50,50,100];
	private const _ReadyH:Array=[100,100,100,100,50,50,50,50,50,50,100];
	/*---------------------------------------------------------------*/
	private const _arr1:Array=[0xF0F0B0,0x86BA90,0x86BA90,0xF0F0B0,0xF0F0B0,0xF0F0B0,0xF0F0B0,0xF0F0B0,0xF0F0B0,0x86BA90,0xFFD7AB];
	private const _arr2:Array=[0x86BA90,0xF0F0B0,0xF0F0B0,0x86BA90,0x7DBF0C,0xD5DD68,0xD5DD68,0x7DBF0C,0x86BA90,0xF0F0B0,0xFB9394];
	private const _arr3:Array=[0x86BA90,0xF0F0B0,0xF0F0B0,0x86BA90,0x86BA90,0x86BA90,0x86BA90,0x86BA90,0x86BA90,0xF0F0B0,0xffffff]
	public var callNum:int;
public function drawBlock( nums:Number){
		callNum=nums;
		var yoko:uint=_ReadyW[nums];
		var tate:uint=_ReadyH[nums];
		var block_sp:MovieClip = new MovieClip();
		block_sp.graphics.beginFill(_arr1[nums]);
		block_sp.graphics.drawRoundRect(0,0,yoko,tate,20);
		block_sp.graphics.endFill();
		filters = [ new GlowFilter( _arr2[nums], 1, 40, 40, 1,2,true ) ] ;	
		switch(nums){
				case 0:
				case 3:
				case 1:
				case 2:
							var pic1:drawRabi=new drawRabi(_arr3[nums]);
							block_sp.addChild(pic1);
							pic1.x=15
							pic1.y=50;
				break;
				case 4:
				case 7:
				case 8:
				case 5:
				case 6:
				case 9:
							var _pic2:drawFlower=new drawFlower(_arr3[nums]);
							block_sp.addChild(_pic2);
							_pic2.x=_pic2.y=25;
							_pic2.scaleX=_pic2.scaleY=3;
				break;
				case 10:
							var pic3:drawRabi=new drawRabi(_arr3[nums]);
							block_sp.addChild(pic3);
							pic3.scaleX=pic3.scaleY=1.8;
							pic3.x=30;
							pic3.y=50;
							var pic4:drawFlower=new drawFlower(0xff6666);
							block_sp.addChild(pic4);
							pic4.scaleX=pic4.scaleY=2;
							pic4.x=48;
							pic4.y=60;
				break;
				default:break;
		}
		block_sp.graphics.endFill();
		this.addChild(block_sp);
		mouseChildren = false;
}
}
class drawRabi extends Sprite{
		private var myArray0:Array=["_body","_head","_ear1","_ear2"];
		private var myArray1:Array=[0,3,4,12];//_x
		private var myArray2:Array=[0,-12,-20,-20];//_y
		private var myArray3:Array=[20,15,5,5];//_width
		private var myArray4:Array=[20,15,10,10];//_height
public function drawRabi(colors){	
			var _pointX:uint=0;
			var _pointY:uint=0;			
			var _array:Array=new Array();			
			for(var j:int=0; j < 4; j++){
					var rb_sp:Sprite = new Sprite();					
					rb_sp.graphics.beginFill(colors);
					rb_sp.graphics.drawEllipse(0,0, myArray3[j], myArray4[j]);
					if(j==1){
						rb_sp.graphics.drawCircle(4,5,1.2);
						rb_sp.graphics.drawCircle(10,5,1.2);
						rb_sp.graphics.drawCircle(7,9,1.7);				
					}					
					rb_sp.graphics.endFill();						
					//しっかり入れとくこと
					rb_sp.x=_pointX+myArray1[j];
					rb_sp.y=_pointY+myArray2[j];					
					rb_sp.name=myArray0[j];
					_array.push(rb_sp);
					this.addChild(rb_sp);
			}		
	}
}
class drawFlower extends Sprite{
public function drawFlower(colors){
			for(var j:int=0; j < 5; j++){
					var fl_sp:Sprite = new Sprite();					
					fl_sp.graphics.beginFill(colors);
					fl_sp.graphics.drawEllipse(-1,0.5,2,4);					
					fl_sp.graphics.endFill();						
					fl_sp.rotation=j*72+180;
					addChild(fl_sp);
			}		
	}
}
import flash.display.BlendMode;
import flash.text.*;
class goalPicture extends Sprite{
public function goalPicture(){
			blendMode = BlendMode.LAYER;
			//テキストフォーマット作成                
			var fmt:TextFormat = new TextFormat();
			fmt.size  = 34;
			fmt.color = 0xEF324E;
			fmt.font="Impact";
			//テキストフィールド作成
			var tf:TextField = new TextField();
			tf.selectable = false;
			tf.defaultTextFormat = fmt;
			tf.text = "Congratulations !!";
			tf.width=300;
			addChild(tf);
	}
}
class back_ground extends Sprite{
public function back_ground(){
	var arr:Array=[0xB2DE93,0xF0F0B0,0xE3DA37];
	var bg:Sprite=new Sprite();
	bg.graphics.beginFill(0xFFFFFF,1);
	bg.graphics.drawRect(0,0,465,465);
	bg.graphics.endFill();
	addChild(bg);
	for(var j:uint=0; j < 100; j++) {
		var panel:drawFlower=new drawFlower(0xFFFFFF);		
		panel.x=Math.floor (Math.random() * 465);
		panel.y=Math.floor (Math.random() * 465);
		panel.scaleX=panel.scaleY=Math.floor (Math.random() * 3)+2;
		panel.rotation=Math.floor (Math.random() * 465);
		var rnd=Math.floor(Math.random()*3);
		panel.filters = [ new GlowFilter(arr[rnd], 1, 20, 20, 1,2,false ) ] ;	
		bg.addChild(panel);
	}
}
}