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

SWFVectorとWonderflUtilsのテスト

何気なく入ったライブラリSWFVectorを使ってみた。
Get Adobe Flash player
by paq 14 Apr 2010
    Embed
/**
 * Copyright paq ( http://wonderfl.net/user/paq )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/esIu
 */

// 何気なく入ったライブラリSWFVectorを使ってみた。
package
{
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	import flash.text.Font;
	import flash.utils.ByteArray;
	import org.papervision3d.cameras.CameraType;
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.materials.special.VectorShapeMaterial;
	import org.papervision3d.materials.utils.MaterialsList;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.objects.primitives.Cube;
	import org.papervision3d.objects.special.VectorShape3D;
	import org.papervision3d.view.BasicView;
	import wumedia.vector.VectorText;
	import net.wonderfl.utils.FontLoader;
	
	[SWF(backgroundColor="#FFFFFF", width=465, height=465, frameRate=60)]
	public class Main extends BasicView
	{
		public function Main() 
		{
			super(0, 0, true);
			init();
			startRendering();
		}
		
		private var _text:VectorShape3D;
		private var _loader:FontLoader;
		
		private function init():void
		{
			_loader = new FontLoader;
			_loader.load("IPAGP");
			_loader.addEventListener( Event.COMPLETE, loaded);
		}
		
		private function loaded(e:Event):void 
		{
			VectorText.extractFont(_loader.loader.contentLoaderInfo.bytes, null, true);
			
			_text = new VectorShape3D(new VectorShapeMaterial());
			_text.graphics.beginFill(0x000000);
			VectorText.write(_text.graphics, "IPAGP", 150, 300, 0, "日本語も使える", 0, 0, Number.POSITIVE_INFINITY, VectorText.CENTER);
			_text.graphics.endFill();
			scene.addChild(_text);
		}
		
		override protected function onRenderTick(e:Event = null):void
		{
			if (!_text) return;
			_text.rotationX -= 1;
			_text.rotationY += 1;
			super.onRenderTick(e);
		}
	}
}