topical media & game development
lib-flex-animation-code-07-Container3D.ax
lib-flex-animation-code-07-Container3D.ax
(swf
)
[ flash
]
flex
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFormat;
[SWF(width=800, height=800, backgroundColor=0xffffff)]
public class @ax-lib-flex-animation-code-07-Container3D extends Sprite
{
private var _sprite:Sprite;
private var _n:Number = 0;
public function @ax-lib-flex-animation-code-07-Container3D()
{
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
_sprite = new Sprite();
_sprite.y = stage.stageHeight / 2;
for(var i:int = 0; i < 100; i++)
{
var tf:TextField = new TextField();
tf.defaultTextFormat = new TextFormat("Arial", 40);
tf.text = String.fromCharCode(65 + Math.floor(Math.random() * 25));
tf.selectable = false;
tf.x = Math.random() * 300 - 150;
tf.y = Math.random() * 300 - 150;
tf.z = Math.random() * 1000;
_sprite.addChild(tf);
}
addChild(_sprite);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void
{
_sprite.x = stage.stageWidth / 2 + Math.cos(_n) * 200;
_n += .05;
}
}
}
(C) Æliens
18/6/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.