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

forked from: type_demo

Get Adobe Flash player
by hacker_nyk19sk7 16 Apr 2010
/**
 * Copyright hacker_nyk19sk7 ( http://wonderfl.net/user/hacker_nyk19sk7 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/6k52
 */

package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.system.Security;
    
	[SWF (width="465",height="465",frameRate="24",backgroundColor="#FFFFFF")]
	
    public class type_demo extends Sprite
    {
    		public var shiba:Pet;
    		public var neko:Pet;
    		public var panda:Pet;
    		public var kame:Pet;
    		public var boston:Pet;
    		
        public function type_demo()
        {
        		shiba = new Pet(PetURL.SHIBA);
        		shiba.scaleX = shiba.scaleY = 0.5;
			shiba.x = 50;
			shiba.y = 150;
			addChild(shiba);
			
			neko = new Pet(PetURL.NEKO);
			neko.scaleX = neko.scaleY = 0.5;
			neko.x = 150;
			neko.y = 150;
			addChild(neko);
			
			panda = new Pet(PetURL.PANDA);
			panda.scaleX = panda.scaleY = 0.5;
			panda.x = 250;
			panda.y = 150;
			addChild(panda);
			
			kame = new Pet(PetURL.PANDA);
			kame.scaleX = kame.ScaleY = 0.5;
			kame.x = 50;
			kame.y = 250;
			addChild(Kame);
			
			boston = new Pet(PetURL.BOSTON);
			boston.scaleX = boston.scaleY = 0.5;
			boston.x = 150;
			boston.y = 250;
			addChild(boston);
		}
	}
}

import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;

class Pet extends Sprite
{
	public var onLoad:Function;
	private var current:MovieClip;
	private var urlLoader:URLLoader;
	private var loader:Loader;
	
	public function Pet(url:String)
	{
		urlLoader = new URLLoader();
		urlLoader.dataFormat = urlLoaderDataFormat.BINARY;
		urlLoader.addEventListener(Event.COMPLETE, onLoad1);
		urlLoader.load(new URLRequest(url));
	}	
	
	private function onLoad1(e:Event):void
	{
		loader = new Loader();
		loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad2);
		loader.loadBytes(urlLoader.date);
	}

	private function onLoad2(e:Event):void
	{
		var clazz:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("Pet")as Class;
		var pet:MovieClip = new clazz();
		pet.front.x = 0;
		pet.front.y = 0;
		addChild(pet.front);
		current = pet.front;
		if(onLoad != null) onLoad();
	}
	
	public function playAction(code:String):void
	{
		current.gotoAndPlay(code);
	}
}

class PetURL
{
	public static var SHIBA:String = "http://stat.ameba.net/training2010/shiba.swf";
	public static var NEKO:String = "http://stat.ameba.net/training2010/neko.swf";
	public static var PANDA:String = "http://stat.ameba.net/training2010/panda.swf";
	public static var KAME:String = "http://stat.ameba.net/training2010/kame.swf";
	public static var BOSTON:String = "http://stat.ameba.net/training2010/boston.swf";
}