SVG Test1

by flabaka
http://www.adobe.com/jp/devnet/flash/articles/spark_project_svg.html
*    この記事を参考にさせていただき、試してみた。
*   wonderflでFShapeSVGが使えるようになったので、以前ブログにエントリしたやつをこちらに。
♥0 | Line 27 | Modified 2009-05-23 00:20:00 | MIT License
play

ActionScript3 source code

/**
 * Copyright flabaka ( http://wonderfl.net/user/flabaka )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xu8M
 */

/*
*    http://www.adobe.com/jp/devnet/flash/articles/spark_project_svg.html
*    この記事を参考にさせていただき、試してみた。
*   wonderflでFShapeSVGが使えるようになったので、以前ブログにエントリしたやつをこちらに。
*/

package{
         import flash.display.Sprite;
         import frocessing.shape.FShapeSVG;
		 import caurina.transitions.Tweener;
		 import flash.utils.Timer;
		 import flash.events.TimerEvent;
		 import caurina.transitions.properties.ColorShortcuts;

         public class SVGTest1 extends Sprite{

			private var sp:Sprite = new Sprite();
			private  var timer:Timer = new Timer(2000);
			ColorShortcuts.init();

			public function SVGTest1(){
                            var svg:XML =
                                     <svg>
                                               <rect width="50" height="50" fill="#333333" />
                                     </svg>;

                            var shapedata:FShapeSVG = new FShapeSVG(svg);
							sp = shapedata.toSprite();
                            addChild(sp);

							
							timer.start();
							timer.addEventListener(TimerEvent.TIMER,updateHandler);
                   };

				  private function updateHandler(e:TimerEvent):void{
					   Tweener.addTween(sp, {x:Math.floor(Math.random()*400),y:Math.floor(Math.random()*325),time:1,_color:Math.floor(Math.random()* 0xFFFFFF)})
				   }
         }
}