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

Digi:Nium Generator

左上の顔パーツを適当に動かすと、顔の球のマテリアル内でもパーツが動きます。
Get Adobe Flash player
by k3lab 23 Oct 2009
/**
 * Copyright k3lab ( http://wonderfl.net/user/k3lab )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/kHyi
 */

// forked from checkmate's Progression4 Amateur
package {
	/*
	 * 左上の顔パーツを適当に動かすと、顔の球のマテリアル内でもパーツが動きます。
	 * 
	 *
	 * 
	 */
	import flash.display.*;
	import flash.events.*;
	import flash.geom.Rectangle;
	import flash.geom.Matrix;
	import flash.utils.getTimer;
	import flash.net.URLRequest
	import frocessing.color.ColorHSV;
	import jp.progression.casts.*;
	import jp.progression.commands.*;
	import jp.progression.commands.lists.*;
	import jp.progression.commands.net.*;
	import jp.progression.config.*;
	import jp.progression.data.*;
	import jp.progression.events.*;
	import jp.progression.scenes.*;
	import jp.progression.*;
	//
	[SWF(width="465", height="465", frameRate="30")]
	public class Amateur extends Sprite {
		public var manager:Progression, self:Amateur;
		// Graphics
		public var face:MovieClip;
		public var hair:MovieClip;
		public var eyeBrowLeft:MovieClip, eyeBrowRight:MovieClip;
		public var eyeLeft:MovieClip, eyeRight:MovieClip;
		public var nose:MovieClip;
		public var mouth:MovieClip;
		//
		private var _hsv:ColorHSV;
		private var _sp:Sprite;
		private var _w:Number;
		private var _h:Number;
		private var _bmp:Bitmap;
		private var _bmpData:BitmapData;
		private var _Array:Array = [];
		//*****************************
		// Do Something
		public function atReady():void {
			//背景画像
			addChild(new CastBitmap(getResourceById(CheckmateBuilder.BG_URL).data)); 
			//
			_hsv = new ColorHSV();
			//
			_sp = addChild(new Sprite()) as Sprite;
			_sp.x = _sp.y = -35;
			for (var n:int = 0; n < 15; n++) {
				for (var j:int = 0; j < 15; j++) {
					var par:Sprite = _sp.addChild(new Sprite()) as Sprite;
					par.graphics.beginFill(0xFFFFFF);
					par.graphics.drawRect(0, 0, 10, 10);
					par.graphics.endFill()
					par.x = par.width * n;
					par.y = par.width * j;
					_Array.push(par);
				}
			}
			//**************************************
			//顔の球を作成
			var sphere:Spheres = addChild(new Spheres(_sp)) as Spheres;
			sphere.y = 20;
			
			//**************************************
			//パーツ類の設定
			mouth.scaleX = mouth.scaleY = 0.4;
			nose.scaleX = nose.scaleY = 0.4;
			eyeRight.scaleX = eyeRight.scaleY = 0.4;
			eyeLeft.scaleX = eyeLeft.scaleY = 0.45;
			eyeBrowLeft.scaleX = eyeBrowLeft.scaleY = 0.4;
			eyeBrowRight.scaleX = eyeBrowRight.scaleY = 0.4;
			
			nose.addEventListener(MouseEvent.MOUSE_DOWN, _drag);
			mouth.addEventListener(MouseEvent.MOUSE_DOWN, _drag);
			eyeRight.addEventListener(MouseEvent.MOUSE_DOWN, _drag);
			eyeLeft.addEventListener(MouseEvent.MOUSE_DOWN, _drag);
			eyeBrowRight.addEventListener(MouseEvent.MOUSE_DOWN, _drag);
			eyeBrowLeft.addEventListener(MouseEvent.MOUSE_DOWN, _drag);
			
			_sp.addChild( mouth );
			_sp.addChild( nose );
			_sp.addChild( eyeLeft );
			_sp.addChild( eyeRight );
			_sp.addChild( eyeBrowLeft );
			_sp.addChild( eyeBrowRight );
			
			//**************************************
			//髪の毛のモザイク
			var bmpData:BitmapData = new BitmapData(1,1);
			_bmp = new Bitmap(bmpData);
			addChild(_bmp);
			_w = hair.width * 2;
			_h = hair.height * 2;
			_bmp.x = 30;
			_bmp.y = -10;
			setMosaic( hair );
			//**************************************
			//
			stage.addEventListener( MouseEvent.MOUSE_UP, _up );
			addEventListener(Event.ENTER_FRAME, loop );
			
		}
		private function loop(e:Event):void {
			_hsv.h = ++_hsv.h % 360;
			for each(var mc:Sprite in _Array) {
				mc.alpha = Math.sin(getTimer()  * Math.random() * 100) + 1.4;
				mc.graphics.clear();
				mc.graphics.beginFill(_hsv.value);
				mc.graphics.drawRect(0, 0, 10, 10);
				mc.graphics.endFill();
			}
		}
		private function _drag(e:MouseEvent):void {
			e.target.startDrag(false,new Rectangle(40,0,100,140));
		}
		private function _up(e:MouseEvent):void {
			stopDrag();
		}
		//髪の毛のモザイク処理
		public function setMosaic(mc:Sprite):void { 
			var Mtx:Matrix = new Matrix(); 
			var scaleNum:uint = 10;
			Mtx.scale( 1 / scaleNum, 1 / scaleNum );
			Mtx.translate( 20, 20);
			_bmpData = new BitmapData( _w/scaleNum, _h/scaleNum, true, 0x000000 ); 
			_bmpData.draw( mc, Mtx ); 
			_bmp.bitmapData = _bmpData; 
			_bmp.scaleX = _w/_bmpData.width; 
			_bmp.scaleY = _h/_bmpData.height; 
		}
		public function Amateur() {
			CheckmateBuilder.initialize( this );
		}
	}
}

import org.papervision3d.core.proto.LightObject3D;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.materials.MovieMaterial;
import org.papervision3d.materials.shaders.PhongShader;
import org.papervision3d.materials.shaders.ShadedMaterial;
import org.papervision3d.view.BasicView;
import org.papervision3d.objects.primitives.Sphere
import org.papervision3d.materials.shaders.FlatShader

class Spheres extends BasicView {
	private var _movie:Sprite;
	public function Spheres(movie:Sprite) {
		super(465, 465, true, true);
		_movie = movie;
		init();
	}
	public function init():void {
		//カメラの設定
		camera.focus = 100;
		camera.zoom = 11;
		//ライトを作成
		var light:LightObject3D = new LightObject3D();
		// マテリアルを作成
		var tesst:MovieMaterial = new MovieMaterial(_movie, true, true, true);
		// シェイダーを作成 
		var shader:FlatShader = new FlatShader(light, 0xFFFFFF, 0);
		// シェイダーを適用したマテリアルを作成 
		var shadedMaterial:ShadedMaterial = new ShadedMaterial(tesst, shader);
		// 球を作成
		var sphere:Sphere = new Sphere(shadedMaterial, 100,25,25)
		sphere.scaleY = 1.5;
		//
		scene.addChild(sphere);
		addEventListener(Event.ENTER_FRAME, function(e:Event):void {
			light.copyPosition(camera) 
			sphere.yaw(1);
		})
		startRendering();
	}	
}

import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
import flash.system.LoaderContext;
import flash.system.ApplicationDomain;
import jp.progression.casts.*;
import jp.progression.commands.*;
import jp.progression.commands.lists.*;
import jp.progression.commands.net.*;
import jp.progression.config.*;
import jp.progression.data.*;
import jp.progression.events.*;
import jp.progression.scenes.*;
import jp.progression.*;

class CheckmateBuilder extends EventDispatcher {
   	public static var GRAPHICS_URL:String = "http://swf.wonderfl.net/static/assets/checkmate04/AmateurAssets.swf";
	public static var BG_URL:String = "http://www.k3lab.com/wonderfl/diginium/bg.jpg";
	private static var _target:Amateur;
	private static var _manager:Progression;
	public static function initialize( target:Amateur ):void {
		if ( _target ) { return; }
		_target = target;
		_target.self = target;
		Progression.initialize( new BasicAppConfig() );
		_manager = new Progression( "index", _target.stage );
		_manager.root.addEventListener( SceneEvent.SCENE_LOAD, _sceneLoad );
		_manager.root.addEventListener( SceneEvent.SCENE_INIT_COMPLETE, _sceneInitComplete );
		_manager.goto( _manager.root.sceneId );
	}

	private static function _sceneLoad( e:SceneEvent ):void {
		_manager.root.addCommand(
			new LoadSWF( new URLRequest( GRAPHICS_URL ) ),
			function():void {
				var loader:Loader = Loader( this.latestData );
				var domain:ApplicationDomain = loader.contentLoaderInfo.applicationDomain;
				_target.hair = new ( domain.getDefinition( "Hair" ) as Class );
				_target.hair.x = 233;
				_target.hair.y = 194;
				_target.eyeBrowRight = new ( domain.getDefinition( "EyeBrowRight" ) as Class );
				_target.eyeBrowRight.x = 72;
				_target.eyeBrowRight.y = 70;
				_target.eyeBrowLeft = new ( domain.getDefinition( "EyeBrowLeft" ) as Class );
				_target.eyeBrowLeft.x = 100;
				_target.eyeBrowLeft.y = 70;
				_target.eyeRight = new ( domain.getDefinition( "EyeRight" ) as Class );
				_target.eyeRight.x = 73;
				_target.eyeRight.y = 80;
				_target.eyeLeft = new ( domain.getDefinition( "EyeLeft" ) as Class );
				_target.eyeLeft.x = 97;
				_target.eyeLeft.y = 79;
				_target.nose = new ( domain.getDefinition( "Nose" ) as Class );
				_target.nose.x = 86;
				_target.nose.y = 85;
				_target.mouth = new ( domain.getDefinition( "Mouth" ) as Class );
				_target.mouth.x = 88
				_target.mouth.y = 100;
			},
			new LoadBitmapData(new URLRequest(BG_URL), {context:new LoaderContext(true)})
		);
	}
	 
	private static function _sceneInitComplete( e:SceneEvent ):void {
		_target.atReady();
	}
}