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

Super nium theacher!!!!

Get Adobe Flash player
by yd_niku 20 Oct 2009
/**
 * Copyright yd_niku ( http://wonderfl.net/user/yd_niku )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xMY2
 */

// forked from checkmate's Progression4 Amateur
package {

	import flash.display.*;
	import flash.events.*;
	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.*;

        import flash.geom.*;
        import flash.filters.*;
        import flash.text.*;

	[SWF( width=465, height=465, backgroundColor=0, 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 _status:Array;

                public var head:Sprite;
		// Do Something
		public function atReady():void {
                        addChild( head = new Sprite );
			head.addChild( face );
			head.addChild( mouth );
			head.addChild( nose );
			head.addChild( eyeLeft );
			head.addChild( eyeRight );
			head.addChild( eyeBrowLeft );
			head.addChild( eyeBrowRight );
			head.addChild( hair );
                        head.filters = [ new GlowFilter( 0x00, 8, 8, 1 ) ];

			_status = [];

			for ( var i:int = 0, l:int = head.numChildren; i < l; i++ ) {
				var child:DisplayObject = head.getChildAt( i );
				_status.push( {
					x:child.x,
					y:child.y,
					scaleX:child.scaleX,
					scaleY:child.scaleY,
					rotation:child.rotation
				} );
			}

                        addChild( _voiceField );
                        _voiceField.y = 400;
                        _voiceField.width = 465;
                        _voiceField.height = 32;
                        var tf:TextFormat = new TextFormat("_sans", 28);
                        tf.align = TextFormatAlign.CENTER;
                        tf.bold = true;
                        tf.color = 0xFFFFFF;
                        _voiceField.defaultTextFormat = tf;
                        //_voiceField.text = "チンカスのことかーーーっ!!!";
                        
                        _noise = new BitmapData( 465, 465, false, 0 );
                        //addChild( new Bitmap(_noise) );
                        
                        _energy = new BitmapData(465, 465, true, 0);
                        addChild( new Bitmap(_energy)  );

                        updateDisplay();
                        
			stage.addEventListener( MouseEvent.CLICK, _click );
                        addEventListener( Event.ENTER_FRAME, updateEnergy );
		}

                private var _isSuper:Boolean = false;
		private function _click( e:MouseEvent ):void {
                    _isSuper = !_isSuper;
                    updateDisplay();
		}

                private var _hairTransformSuper:ColorTransform = new ColorTransform( 0.7, 0.7, 0.7, 1, 255, 204, 0, 0 );
		private var _hairTransformNormal:ColorTransform = new ColorTransform( 1, 1, 1, 1 );
		
                private var _skinTransformSuper:ColorTransform = new ColorTransform( 0.5, 0.5, 0.5, 1, 204, 153, 153, 0 );
		private var _skinTransformNormal:ColorTransform = new ColorTransform( 1, 1, 1, 1 );
		
                private var _eyeTransformSuper:ColorTransform = new ColorTransform( 1, 1, 1, 1, 0, 204, 51, 0 );
		private var _eyeTransformNormal:ColorTransform = new ColorTransform( 1, 1, 1, 1 );
		
                private var _voiceField:TextField = new TextField();
                private function updateDisplay():void {
                    if( _isSuper ) {
                        hair.transform.colorTransform = _hairTransformSuper;
                        eyeBrowLeft.transform.colorTransform = _hairTransformSuper;
                        eyeBrowRight.transform.colorTransform = _hairTransformSuper;
                        face.transform.colorTransform = _skinTransformSuper;
                        nose.transform.colorTransform = _skinTransformSuper;
                        mouth.transform.colorTransform = _skinTransformSuper;
                        eyeLeft.transform.colorTransform = _eyeTransformSuper;
                        eyeRight.transform.colorTransform = _eyeTransformSuper;
                        addEventListener( Event.ENTER_FRAME, drawEnergy );
                        addEventListener( Event.ENTER_FRAME, updateVoice );
                        
                        var tf:TextFormat= _voiceField.defaultTextFormat;
                        tf.color = 0xFF0000;
                        _voiceField.defaultTextFormat = tf;
                        _voiceField.text = "";
                    }
                    else {
                        _noiseCount.x = _noiseCount.y = 0;
                        hair.transform.colorTransform = _hairTransformNormal;
                        eyeBrowLeft.transform.colorTransform = _hairTransformNormal;
                        eyeBrowRight.transform.colorTransform = _hairTransformNormal;
                        face.transform.colorTransform = _skinTransformNormal;
                        nose.transform.colorTransform = _skinTransformNormal;
                        mouth.transform.colorTransform = _skinTransformNormal;
                        eyeLeft.transform.colorTransform = _eyeTransformNormal;
                        eyeRight.transform.colorTransform = _eyeTransformNormal;
                        removeEventListener( Event.ENTER_FRAME, drawEnergy );
                        removeEventListener( Event.ENTER_FRAME, updateVoice );
                        
                        tf = _voiceField.defaultTextFormat;
                        tf.color = 0xFFFFFF;
                        _voiceField.defaultTextFormat = tf;
                        _voiceField.text = _voiceNormal;
                    }
                }
                
                private var _voiceNormal:String = "オッス!オラ nium!!";
                private var _voiceArgry:String = "チンカスのことかーーーっ!!!";
                
                private var _blur:BlurFilter = new BlurFilter( 8, 8, 2 );
                private var _ctf:ColorTransform= new ColorTransform( 1.2, 1.2, 1.2, 0.9 );
                private var _p:Point = new Point;
                private var _noiseCount:Point = new Point();
                private var _disp:DisplacementMapFilter = new DisplacementMapFilter( null, _p, 1, 0, 20, 0  );
                    
                private function updateEnergy(e:Event):void {
                    _energy.applyFilter( _energy, _energy.rect, _p, _blur );
                    _energy.colorTransform( _energy.rect, _ctf );
                    _energy.scroll( 0, -8);
                    
                    _noise.perlinNoise( 64, 64, 1, 1, false, true, 1, false, [ _noiseCount ] );
                    _noiseCount.x +=3;
                    _noiseCount.y +=3;
                    
                    _disp.mapBitmap = _noise;
                    _energy.applyFilter( _energy, _energy.rect, _p, _disp );
                }
                private function drawEnergy( e:Event ):void{
                    var m:Matrix = new Matrix();
                    m.translate( (Math.random()-0.5)*10, (Math.random()-0.5)*20 + 10);
                    _energy.draw( head, m );
                }
                private var _noise:BitmapData;
                private var _energy:BitmapData;
                
                private function updateVoice(e:Event):void {
                    var count:int = _voiceField.length;
                    if( count == _voiceArgry.length ) removeEventListener( Event.ENTER_FRAME, updateVoice );
                    var char:String = _voiceArgry.substr(count,1);
                    _voiceField.appendText( char );
                }
                
                
		public function Amateur() {
			CheckmateBuilder.initialize( this );
		}
	}
}


import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
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";
	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.face = new ( domain.getDefinition( "Face" ) as Class );
				_target.face.x = 234;
				_target.face.y = 242;
				_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 = 190;
				_target.eyeBrowRight.y = 218;
				_target.eyeBrowLeft = new ( domain.getDefinition( "EyeBrowLeft" ) as Class );
				_target.eyeBrowLeft.x = 270;
				_target.eyeBrowLeft.y = 218;
				_target.eyeRight = new ( domain.getDefinition( "EyeRight" ) as Class );
				_target.eyeRight.x = 190;
				_target.eyeRight.y = 248;
				_target.eyeLeft = new ( domain.getDefinition( "EyeLeft" ) as Class );
				_target.eyeLeft.x = 272;
				_target.eyeLeft.y = 243;
				_target.nose = new ( domain.getDefinition( "Nose" ) as Class );
				_target.nose.x = 236;
				_target.nose.y = 275;
				_target.mouth = new ( domain.getDefinition( "Mouth" ) as Class );
				_target.mouth.x = 242;
				_target.mouth.y = 322;
			}
		);
	}

	private static function _sceneInitComplete( e:SceneEvent ):void {
		_target.atReady();
	}
}