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: forked from: 3D tag cloud for FP10

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

// forked from hacker_umrq_bua's forked from: 3D tag cloud for FP10
// forked from peko's 3D tag cloud for FP10
package
{
	import flash.display.Graphics;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.utils.setTimeout;
	
	import gs.TweenMax;
	import gs.easing.Back;
	
	[SWF(width="465", height="465")]
	public class tags extends Sprite {
		
		private var tagsString:String ="MicroStation®	;	\
GenerativeComponents®	;	\
Bentley Architecture Bentley® 	;	\
Building Mechanical Systems	;	\
Bentley® Structural	;	\
Hevacomp Simulator	;	\
Hevacomp Mechanical Designer	;	\
GEOPAK® Civil Engineering Suite	;	\
InRoads® Storm & Sanitary, Site, Bridge, Survey, Rail Track	;	\
MicroStation® Civil Extension	;	\
Bentley PowerCivilTM	;	\
Bentley® MXROAD®	;	\
LEAP® Bridge, Conspan®, RC-Pier®, ConBox®, GeoMath®	;	\
Bentley Map®	;	\
MicroStation GeoGraphics®	;	\
Bentley® Descartes	;	\
Bentley® I/RAS B	;	\
Bentley® Wastewater	;	\
AutoPLANT® P&ID	;	\
AutoPLANT® Piping	;	\
PlantSpace® P&ID	;	\
PlantSpace® Piping	;	\
Bentley® AutoPIPE	;	\
Bentley® PlantFLOW®	;	\
MicroStation Schematics®	;	\
PlantSpace® Equipment	;	\
PlantSpace® Raceways	;	\
Bentley® Data Manager	;	\
Bentley® Datasheets	;	\
Bentley® Hookups 	;	\
Bentley® Instrumentation and Wiring	;	\
WaterCAD®	;	\
WaterGEMS®	;	\
HAMMER®	;	\
SewerCAD®	;	\
SewerGEMS®	;	\
CivilStorm®	;	\
PondPack®	;	\
StormCAD®	;	\
CulvertMaster®	;	\
FlowMaster®	;	\
RAMTM Structural System	;	\
RAM Steel®, Concrete, Frame®, Foundation	;	\
RAMTM Advanse, Concept, Connection	;	\
STAAD.Pro®	;	\
Offshore Load Generator	;	\
OpenSTAAD	;	\
STAAD.beava, foundation, beam";
		private var tagNamesArray:Array = tagsString.split(";");
		private var tagsArray:Array = []
		
		
		public function tags() {
			super();
			addEventListener(Event.ADDED_TO_STAGE, function (e:Event):void {
				stage.scaleMode = StageScaleMode.NO_SCALE;
				stage.align = StageAlign.TOP_LEFT;
				
				for each (var tagName:String in tagNamesArray) {
					var tag:Sprite = new Sprite;
					var t:TextField = new TextField;
					var rr:int = Math.random() * 0x66;	
					var gg:int = Math.random() * 0xDD;
					var bb:int = Math.random() * 0x99;
					
					var rgb:int = bb + (0x100 * gg) + (0x10000 * rr);
					
					t.defaultTextFormat = new TextFormat("Trebuchet MS", 50, rgb);
					t.text = tagName;
					t.autoSize = TextFieldAutoSize.LEFT;
					t.selectable = false;
					t.x = -t.width/2;
					t.cacheAsBitmap = true;
					tag.addChild(t)
					addChild(tag)
					tagsArray.push(tag);
				}
				
				setTimeout(function():void {for (var i:int = 0; i<30; i++) foolAround()}, 1000);
				//setTimeout(function():void {Wonderfl.capture(stage)}, 30000);
				stage.addEventListener(Event.RESIZE,resize);
				resize();
				stage.addEventListener(MouseEvent.MOUSE_MOVE, function(e:MouseEvent):void 
				{
					var xx:Number = mouseX/stage.stageWidth -0.5;
					var yy:Number = mouseY/stage.stageHeight-0.5;
					for each (var t:Sprite in tagsArray ) 
					{
						t.rotationY =  -xx*45 + 30*t.getRect(t).x/stage.stageWidth;
						t.rotationX =   yy*45 - 30*t.getRect(t).y/stage.stageHeight;
					}
				}
				);
			});
		}
		
		public function resize(e:Event = null):void {
			for each (var t:Sprite in tagsArray ) {
				t.x = stage.stageWidth/2;
				t.y = stage.stageHeight/2;
				t.getChildAt(0).x = stage.stageWidth  *(Math.random()-Math.random());
				t.getChildAt(0).y = stage.stageHeight *(Math.random()-Math.random());
				t.getChildAt(0).z = Math.random()*1000;
				t.getChildAt(0).alpha = 0.5+(1- t.getChildAt(0).z/1000)/2;
			}
		}
		
		public function foolAround():void {
			var zz:Number = Math.random()*1000;
			var i:int = Math.floor(Math.random()*tagsArray.length);
			
			TweenMax.to(
				tagsArray[i].getChildAt(0), 
				Math.random()*5+2,
				{
					ease:Back.easeInOut,
					
					//x: tagsArray[i].x,//stage.stageWidth  *(Math.random()-Math.random()),
					//y: tagsArray[i].y,//y: stage.stageHeight *(Math.random()-Math.random()),
					z: zz,
					//alpha:0.5+(1- zz/1000)/2,
					
					//blur: {blurX: zz/100, blurY: zz/100},
					
					onComplete: foolAround
					
//					onUpdateParams: [i],
//					onUpdate: onUpdate
					
				}
			);
		
		}
		
		public function onUpdate(...arguments):void {
			var i:Number = arguments[0];
 			var r:Rectangle = tagsArray[(i+1) < tagsArray.length ? i+1 : 0].getChildAt(0).getBounds(tagsArray[i]);
 			var g:Graphics = tagsArray[i].graphics;
 			g.clear();
 			g.lineStyle(1,0,0.5);
 			g.lineTo(r.x, r.y);
		}
		
	}
}