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

モジュールのBase64での埋め込みとそのモジュール経由でライブラリを使う

ModuleBase を拡張していないので、モジュールといっていいのかは疑問なのですが。

わざわざ ModuleBase を拡張せず、Sprite を拡張してもいい件。
むしろ ModuleBase を拡張すると容量が多くなるといったデメリットが。

ちなみに、Sprite 拡張 -> Loader から、外部 URL からの読み込みも Base64 で埋め込むことも可。
ModuleBase 拡張 -> ModuleManager から外部 URL からの読み込みのみ確認。Base64 で埋め込んだものはどう扱えばいいのかわからない。

ということで ModuleBase とかのメリットがわからず、Sprite 拡張でモジュール作ったほうがいいのでは?と。

今回 Base64 で埋め込んだ Sprite 拡張版モジュールのソースは最後尾に掲載。

...
@author tkinjo

+xP3ExFbhXiQ2PT0dicYj8fg4OMZ39jeLmQfjmzvnRq7KDm5kd1YK+e1ifmuznzrMLG/tFl8aGSn3urpS6XR7t7Auu1xdiWTXsxvZzeJOJDYRQ0erKzO5rcJGpng1s729nl/JUHeRB+M7a1sr37+f2cuO59YzO2tXIlVGalPMF9ezV2dXt5az/Qvr2Qf9if7ZanvJbbMQ82pV0Ks108xQ64mVrY3IdmFrdXcFMuXQlWxc24S62N5dXs/vrGULV3c3v7+5dX9TclVLiWelkM0Utw5zOGVUv57ZvLebuZe9evNN2bryXcqYKWavvrq72R+LX+qPR6PTthhUeiVCq1uz2uUS3MCrSl9wt2MoNpTcGJpY2Fy5s/DG+vRy7mH23dnZ28mdXCKilALpmf9teee/P+r/t9uvffDv20PmjeD/8CvKvPrVV1+95+Z4KAx8NGWgFf/hz+/Df/afA3hIfu+e39rcKRYy+c3iO1uF9dU3sEjrWeV3LUk0AINydH1QmaBu0q1HV79/Y+bu2tZG9m7x+/nND7buruwWCnge7q5mipm78l7bdDW7l13f2r67nSkU8yvr2fskwt2dwkr88uUje
/**
 * Copyright tkinjo ( http://wonderfl.net/user/tkinjo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xg28
 */

// forked from tkinjo's forked from: wonderfl から外部のモジュールを読み込む
// forked from tkinjo's wonderfl から外部のモジュールを読み込む
package  
{
	/**
	 * ModuleBase を拡張していないので、モジュールといっていいのかは疑問なのですが。
	 * 
	 * わざわざ ModuleBase を拡張せず、Sprite を拡張してもいい件。
	 * むしろ ModuleBase を拡張すると容量が多くなるといったデメリットが。
	 * 
	 * ちなみに、Sprite 拡張 -> Loader から、外部 URL からの読み込みも Base64 で埋め込むことも可。
	 * ModuleBase 拡張 -> ModuleManager から外部 URL からの読み込みのみ確認。Base64 で埋め込んだものはどう扱えばいいのかわからない。
	 * 
	 * ということで ModuleBase とかのメリットがわからず、Sprite 拡張でモジュール作ったほうがいいのでは?と。
	 * 
	 * 今回 Base64 で埋め込んだ Sprite 拡張版モジュールのソースは最後尾に掲載。
	 */
	
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.system.ApplicationDomain;
	import mx.modules.IModuleInfo;
	import mx.modules.ModuleManager;
	
	[SWF(width="465", height="465", frameRate="60", backgroundColor="0xffffff")]
	/**
	 * ...
	 * @author tkinjo
	 */
	public class ModuleParent extends Sprite
	{
		private const MODULE:String = "Q1dTCiVWAAB4Ad1cW3Mcx3Wenp6Znr0vFsDifiUIECCBvS8upEgCICFRN8uUbVESYXgB7BIr45bFAiQYV0yrFJfKuZRL5XLZqVSKVpXKlXISVx7ykLz4PXlZSInzF1J50fgXKN/p2dldLEEQSwh0VUju4Wz36e7TPTPn1l/vA0WUFKVtW1F6mXKjqUNRlB82/wdTlCuF1dzM7RsL/Q821jd3ZvDtpZG1YnF7JhK5f//+xP3ExFbhXiQ2PT0dicYj8fg4OMZ39jeLmQfjmzvnRq7KDm5kd1YK+e1ifmuznzrMLG/tFl8aGSn3urpS6XR7t7Auu1xdiWTXsxvZzeJOJDYRQ0erKzO5rcJGpng1s729nl/JUHeRB+M7a1sr37+f2cuO59YzO2tXI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haXwUIQ5LpCJ821DG2EQz1w1kwmW9VgsjW9DGY1hG7MQI3IY4ma0kaZaRBDBREcxNRAXHqb1VE6+HxZW9aXjVu61QW7xaxuqCdVV3XjF5S0w1mXL/H7AAPWudLBTQ1Zz/MyWY2Edc6gvCb9MNCvKI246M65cULlpzA3pIgNa7jC6H2S0Vdh9FoXDkKj0LmjFX7/YX6cVanp2G/RsRqO2WuQDRK6Flvt3xqSJxRB6GDLWnNFi7oa0qL1v7h2SIsqF06oPZ/o5dTPPoX6J8j01Q/8FO35NavM+lEj9QWnVpnHaMEKWuHk29/0Ux1Sce5XFCeU6Al1Z/3c/l/pzvrJObozHZt84scIn6433WHVbKnqTQ/pTe4X2FTgQCdBjQYFbxIcv+fWLDSAlcJCaxO8XWg4tt6F0FPqzSGoTjpRwYel3kQsxOhkthMpSqUpdSZ+5AMnDGt05oijLRknNUkIpbKaxDZdrZo0dIN2OZpIx2lKE6lJEEMFgYCkJpusZmjIL0hFQkG2kGrUoBr/klRjBzXzKR3Qmwc3OVRjD+1XOXt5v3KU2IILuo5qcu5P4bv2Hs3krWHyWf0HofNQiQNP8sJ7P9RhwBpsRB12NtNyVBMJcs+6/BOe11Hzf/hiEQk=";
		
		private var constraintWorld:Object;
		private var mousePointer:Object;
		
		private function init():void {
			
			constraintWorld = new module.constraintWorld( 0.9 );
			
			mousePointer = new module.particle( mouseX, mouseY );
			
			//*
			var preCircle:Object;
			for ( var i:Number = 0; i < 5; i++ ) {
				
				var circle:Object = new module.circle();
				circle.friction = 0.9;
				constraintWorld.addParticle( circle );
				
				if( i == 0 )
					constraintWorld.addConstraint( new module.springConstraint( mousePointer, circle, 0.1, 20 ) );
				
				else if ( i < 3 ) {
					
					circle.friction = 0.5;
					constraintWorld.addConstraint( new module.followConstraint( preCircle, circle, 20 ) );
					
				} else
					constraintWorld.addConstraint( new module.springConstraint( preCircle, circle, 0.1, 20 ) );
				
				addChild( circle as DisplayObject );
				
				preCircle = circle;
			}
			//*/
			
			addEventListener( Event.ENTER_FRAME, enterFrameHandler );
		}
		
		/**
		 * 
		 * @param	event
		 */
		private function enterFrameHandler( event:Event ):void {
			
			mousePointer.x = mouseX;
			mousePointer.y = mouseY;
			
			constraintWorld.step();
		}
		
		
		
		
		
		/** --------------------------------------------------
		 * Module Load
		 */
		
		private var assetModule:IModuleInfo;
		private var module:Object;
		
		public function ModuleParent() 
		{
			Base64Loader( MODULE, loaderCompleteHandler );
		}
		
		private function loaderCompleteHandler( event:Event ):void {
			
			module = event.currentTarget.content;
			init();
		}
	}
}

import flash.display.Loader;
import flash.events.Event;

function Base64Loader( data:String, complete:Function = null ):Loader
{

	var loader:Loader = new Loader();

	if( complete != null )
	loader.contentLoaderInfo.addEventListener( Event.COMPLETE, complete );

	loader.loadBytes( Base64toByteArray( data ) );

	return loader;
}

import flash.utils.ByteArray;
import mx.utils.Base64Decoder;

function Base64toByteArray( data:String ):ByteArray
{
		var byteArray:ByteArray;
		var base64Decoder:Base64Decoder;;

		base64Decoder = new Base64Decoder();
		base64Decoder.decode(data);

		try {
			byteArray = base64Decoder.toByteArray();
			byteArray.position = 0;
		} catch (e:Error) {
			return null;
	}

	return byteArray;
}

/**
今回 Base64 で埋め込んだ Sprite 拡張版モジュール

package  
{
	import com.tkinjo.constraintworld.constraint.*;
	import com.tkinjo.constraintworld.data.*;
	import com.tkinjo.constraintworld.world.*;
	import flash.display.Sprite;
	
	public class ConstraintWorldModule extends Sprite
	{
		
		public function ConstraintWorldModule() 
		{
			
		}
		
		public function get iConstraint():Class { return IConstraint; }
		public function get constraint():Class { return Constraint; }
		public function get followConstraint():Class { return FollowConstraint; }
		public function get springConstraint():Class { return SpringConstraint; }
		
		public function get circle():Class { return Circle; }
		public function get iParticle():Class { return IParticle; }
		public function get particle():Class { return Particle; }
		
		public function get constraintWorld():Class { return ConstraintWorld; }
	}
	
}
*/