Section 1
//ImageCloud (com.ImageCloud)
package com {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class ImageCloud extends MovieClip {
private var hicolor:Number;
private var active:Boolean;
private var lasta:Number;
private var distr:Boolean;
private var radius:Number;// = 150
private var originy:Number;
private var originx:Number;
private var lastb:Number;
private var tcolor2:Number;
private var holder:MovieClip;
private var myXML:XML;
private var fontFace:String;
private var sa:Number;
private var sb:Number;
private var sc:Number;
private var tspeed:Number;
private var mcList:Array;
private var ca:Number;
private var cb:Number;
private var cc:Number;
private var dtr:Number;// = 0.0174532925199433
private var d:Number;// = 300
private var tcolor:Number;
private var cloud_data:String;
public function ImageCloud(){
var a:Array;
var baseURL:String;
var myXMLURL:URLRequest;
var myLoader:URLLoader;
super();
var swfStage:Stage = this.stage;
swfStage.scaleMode = StageScaleMode.NO_SCALE;
swfStage.align = StageAlign.TOP_LEFT;
cloud_data = ((this.loaderInfo.parameters.cloud_data)==null) ? "cloud_data.xml" : String(this.loaderInfo.parameters.cloud_data);
tcolor = ((this.loaderInfo.parameters.tcolor)==null) ? 0x333333 : Number(this.loaderInfo.parameters.tcolor);
tcolor2 = ((this.loaderInfo.parameters.tcolor2)==null) ? 0x995500 : Number(this.loaderInfo.parameters.tcolor2);
hicolor = ((this.loaderInfo.parameters.hicolor)==null) ? 0 : Number(this.loaderInfo.parameters.hicolor);
tspeed = ((this.loaderInfo.parameters.tspeed)==null) ? 1 : (Number(this.loaderInfo.parameters.tspeed) / 100);
fontFace = ((this.loaderInfo.parameters.fontFace)==null) ? "Arial" : String(this.loaderInfo.parameters.fontFace);
distr = true;
myXML = new XML();
if (this.loaderInfo.parameters.mode == null){
var xmlLoaded:Function = function (_arg1:Event):void{
myXML = XML(myLoader.data);
init(myXML);
};
a = this.loaderInfo.url.split("/");
a.pop();
baseURL = (a.join("/") + "/");
myXMLURL = new URLRequest((baseURL + cloud_data));
myLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
};
}
private function resizeHolder():void{
var _local1:Stage = this.stage;
holder.x = (_local1.stageWidth / 2);
holder.y = (_local1.stageHeight / 2);
var _local2:Number = ((_local1.stageWidth)>_local1.stageHeight) ? (_local1.stageHeight / (radius * 4)) : (_local1.stageWidth / (radius * 4));
holder.scaleX = (holder.scaleY = _local2);
}
private function depthSort():void{
mcList.sortOn("cz", (Array.DESCENDING | Array.NUMERIC));
var _local1:Number = 0;
var _local2:Number = 0;
while (_local2 < mcList.length) {
holder.setChildIndex(mcList[_local2], _local2);
if (mcList[_local2].active == true){
_local1 = _local2;
};
_local2++;
};
holder.setChildIndex(mcList[_local1], (mcList.length - 1));
}
private function updateTags(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
if (active){
_local2 = ((-(Math.min(Math.max(holder.mouseY, -(d)), d)) / radius) * tspeed);
_local3 = ((Math.min(Math.max(holder.mouseX, -(d)), d) / radius) * tspeed);
} else {
_local2 = (lasta * 0.98);
_local3 = (lastb * 0.98);
};
lasta = _local2;
lastb = _local3;
if ((((Math.abs(_local2) > 0.01)) || ((Math.abs(_local3) > 0.01)))){
_local4 = 0;
sineCosine(_local2, _local3, _local4);
_local5 = 0;
while (_local5 < mcList.length) {
_local6 = mcList[_local5].cx;
_local7 = ((mcList[_local5].cy * ca) + (mcList[_local5].cz * -(sa)));
_local8 = ((mcList[_local5].cy * sa) + (mcList[_local5].cz * ca));
_local9 = ((_local6 * cb) + (_local8 * sb));
_local10 = _local7;
_local11 = ((_local6 * -(sb)) + (_local8 * cb));
_local12 = ((_local9 * cc) + (_local10 * -(sc)));
_local13 = ((_local9 * sc) + (_local10 * cc));
_local14 = _local11;
mcList[_local5].cx = _local12;
mcList[_local5].cy = _local13;
mcList[_local5].cz = _local14;
_local15 = (d / (d + _local14));
mcList[_local5].x = (_local12 * _local15);
mcList[_local5].y = (_local13 * _local15);
mcList[_local5].scaleX = (mcList[_local5].scaleY = _local15);
mcList[_local5].alpha = (_local15 / 2);
_local5++;
};
depthSort();
};
}
private function init(_arg1:XML):void{
var _local4:XML;
var _local5:XML;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:String;
var _local12:OneElement;
sineCosine(0, 0, 0);
mcList = [];
active = false;
lasta = 1;
lastb = 1;
holder = new MovieClip();
addChild(holder);
resizeHolder();
var _local2:Number = 0;
var _local3:Number = 9999;
for each (_local4 in _arg1.a) {
_local6 = getNumberFromString(_local4["@style"]);
_local2 = Math.max(_local2, _local6);
_local3 = Math.min(_local3, _local6);
};
for each (_local5 in _arg1.a) {
_local7 = getNumberFromString(_local5["@style"]);
_local8 = ((_local3)==_local2) ? 1 : ((_local7 - _local3) / (_local2 - _local3));
_local9 = ((_local5["@color"])==undefined) ? getColorFromGradient(_local8) : Number(_local5["@color"]);
_local10 = ((_local5["@hicolor"])==undefined) ? ((hicolor)==tcolor) ? getColorFromGradient(_local8) : hicolor : Number(_local5["@hicolor"]);
_local11 = ((_local5["@rev"])==undefined) ? "" : String(_local5["@rev"]);
_local12 = new OneElement(_local5, _local9, _local10, _local11, fontFace);
holder.addChild(_local12);
mcList.push(_local12);
};
positionAll();
addEventListener(Event.ENTER_FRAME, updateTags);
stage.addEventListener(Event.MOUSE_LEAVE, mouseExitHandler);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
stage.addEventListener(Event.RESIZE, resizeHandler);
}
private function positionAll():void{
var phi:Number = 0;
var theta:Number = 0;
var max:Number = mcList.length;
mcList.sort(function (){
return (((Math.random() < 0.5)) ? 1 : -1);
});
var i:Number = 1;
while (i < (max + 1)) {
if (distr){
phi = Math.acos((-1 + (((2 * i) - 1) / max)));
theta = (Math.sqrt((max * Math.PI)) * phi);
} else {
phi = (Math.random() * Math.PI);
theta = (Math.random() * (2 * Math.PI));
};
mcList[(i - 1)].cx = ((radius * Math.cos(theta)) * Math.sin(phi));
mcList[(i - 1)].cy = ((radius * Math.sin(theta)) * Math.sin(phi));
mcList[(i - 1)].cz = (radius * Math.cos(phi));
i = (i + 1);
};
}
private function getColorFromGradient(_arg1:Number):Number{
var _local2:Number = ((_arg1 * (tcolor >> 16)) + ((1 - _arg1) * (tcolor2 >> 16)));
var _local3:Number = ((_arg1 * ((tcolor >> 8) % 0x0100)) + ((1 - _arg1) * ((tcolor2 >> 8) % 0x0100)));
var _local4:Number = ((_arg1 * (tcolor % 0x0100)) + ((1 - _arg1) * (tcolor2 % 0x0100)));
return ((((_local2 << 16) | (_local3 << 8)) | _local4));
}
private function mouseMoveHandler(_arg1:MouseEvent):void{
active = true;
}
private function sineCosine(_arg1:Number, _arg2:Number, _arg3:Number):void{
sa = Math.sin((_arg1 * dtr));
ca = Math.cos((_arg1 * dtr));
sb = Math.sin((_arg2 * dtr));
cb = Math.cos((_arg2 * dtr));
sc = Math.sin((_arg3 * dtr));
cc = Math.cos((_arg3 * dtr));
}
private function mouseExitHandler(_arg1:Event):void{
active = false;
}
private function resizeHandler(_arg1:Event):void{
resizeHolder();
}
private function getNumberFromString(_arg1:String):Number{
return (Number(_arg1.match(/(\d|\.|\,)/g).join("").split(",").join(".")));
}
}
}//package com
Section 2
//OneElement (com.OneElement)
package com {
import flash.events.*;
import flash.text.*;
import flash.display.*;
import flash.net.*;
public class OneElement extends Sprite {
private var _hicolor:Number;
private var _back:Sprite;
private var _tf:TextField;
private var _cx:Number;
private var _cy:Number;
private var _cz:Number;
private var _image:String;
private var _node:XML;
private var _color:Number;
private var _active:Boolean;
private var _fontFace:String;
public function OneElement(_arg1:XML, _arg2:Number, _arg3:Number, _arg4:String, _arg5:String){
var onComplete:Function;
var imageLoader:Loader;
var imageRequest:*;
var node = _arg1;
var color = _arg2;
var hicolor = _arg3;
var image = _arg4;
var fontFace = _arg5;
super();
onComplete = function (_arg1:Event){
var _local2:MovieClip = new MovieClip();
_local2.addChild(imageLoader.content);
var _local3:Number = (_back.width / _local2.width);
_local2.width = (_local2.width * _local3);
_local2.height = (_local2.height * _local3);
_local2.x = (-(_local2.width) / 2);
_local2.y = (_back.height / 2);
addChild(_local2);
};
_node = node;
_color = color;
_hicolor = hicolor;
_active = false;
_image = image;
_fontFace = fontFace;
_tf = new TextField();
_tf.autoSize = TextFieldAutoSize.LEFT;
_tf.selectable = false;
var format:TextFormat = new TextFormat();
format.font = _fontFace;
format.bold = true;
format.color = color;
format.size = (2 * getNumberFromString(node["@style"]));
_tf.defaultTextFormat = format;
_tf.embedFonts = true;
_tf.text = node;
addChild(_tf);
_tf.x = (-(this.width) / 2);
_tf.y = (-(this.height) / 2);
_back = new Sprite();
_back.graphics.beginFill(_hicolor, 0);
_back.graphics.lineStyle(0, _hicolor);
_back.graphics.drawRect(0, 0, (_tf.textWidth + 20), (_tf.textHeight + 5));
_back.graphics.endFill();
addChildAt(_back, 0);
_back.x = (-((_tf.textWidth / 2)) - 10);
_back.y = (-((_tf.textHeight / 2)) - 2);
if (_image != ""){
imageLoader = new Loader();
imageRequest = new URLRequest(_image);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
imageLoader.load(imageRequest);
};
_back.visible = false;
this.buttonMode = true;
addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
private function mouseUpHandler(_arg1:MouseEvent):void{
var _local2:URLRequest = new URLRequest(_node["@href"]);
navigateToURL(_local2, "_self");
}
public function get active():Boolean{
return (_active);
}
public function set cz(_arg1:Number){
_cz = _arg1;
}
private function mouseOutHandler(_arg1:MouseEvent):void{
_back.visible = false;
_tf.textColor = _color;
_active = false;
}
private function mouseOverHandler(_arg1:MouseEvent):void{
_back.visible = true;
_tf.textColor = _hicolor;
_active = true;
}
public function get cx():Number{
return (_cx);
}
public function get cy():Number{
return (_cy);
}
public function get cz():Number{
return (_cz);
}
public function set cx(_arg1:Number){
_cx = _arg1;
}
private function getNumberFromString(_arg1:String):Number{
return (Number(_arg1.match(/(\d|\.|\,)/g).join("").split(",").join(".")));
}
public function set cy(_arg1:Number){
_cy = _arg1;
}
}
}//package com
Section 3
//Arial (Arial)
package {
import flash.text.*;
public dynamic class Arial extends Font {
}
}//package
Section 4
//Impact (Impact)
package {
import flash.text.*;
public dynamic class Impact extends Font {
}
}//package
Section 5
//TimesNewRoman (TimesNewRoman)
package {
import flash.text.*;
public dynamic class TimesNewRoman extends Font {
}
}//package
Section 6
//TrebuchetMS (TrebuchetMS)
package {
import flash.text.*;
public dynamic class TrebuchetMS extends Font {
}
}//package