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

flash on 2010-3-5

Get Adobe Flash player
by hiro_rec 01 Sep 2012
    Embed
/**
 * Copyright hiro_rec ( http://wonderfl.net/user/hiro_rec )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/hTGY
 */

package
{
    import __AS3__.vec.Vector;
    
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.filters.GlowFilter;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    
    
    [SWF(frameRate="48", backgroundColor="0x000000")]
    
    public class TextCircleDemo01 extends Sprite
    {    
        private var text:String;
        private var textFieldList:Vector.<TextField>;
        private var container:Sprite;
        
        
        public function TextCircleDemo01()
        {
            initialize();
        }
        
        private function initialize():void
        {
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            
            graphics.beginFill(0x0);
            graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
            
            textFieldList = new Vector.<TextField>();
            
            container = new Sprite();
            addChild(container);
            
            text = "鳩山由紀夫首相は4日夕、米軍普天間飛行場(沖縄県宜野湾市)の移設問題について、首相官邸で記者団に「3月中のいずれかの時点には、政府の考えをまとめなければならない」と述べ、月内に移設案を絞り込む考えを明らかにした。";
            text += "菅直人副総理兼財務相は4日の参院予算委員会で、財政運営について、「リーマンショックの状況の中では、財政出動を少なくとももう1年か何年かは維持する」と述べ、景気重視の予算編成を数年間は続ける方針を明らかにした。その上で、財政再建に関連し、「その後に向かって考える時に、国内総生産(GDP)に対する債務残高の比率は大きな指標になり得る」と指摘した。(時事通信)";
            
            var i:int;
            var len:int = text.length;
            var char:String;
            var format:TextFormat = new TextFormat("_明朝", 12, 0xFFFFFF, true);
            var textField:TextField;
            var glow:GlowFilter = new GlowFilter(0x00FF00, 0.7, 3, 2, 2, 3);
            
            for (i = 0; i < len; i++)
            {
                char = text.charAt(i);
                
                textField = new TextField();
                textField.defaultTextFormat = format;
                textField.autoSize = TextFieldAutoSize.CENTER;
                textField.text = text.charAt(i);
                textField.selectable = false;
                //textField.filters = [glow];
                
                container.addChild(textField);
                textFieldList.push(textField);
            }
            
            textFieldList.reverse();
            
            container.x = stage.stageWidth / 2;
            container.z = radius / 2 * -1;
            //container.y = -1500;
            
            addEventListener(Event.ENTER_FRAME, render);
        }
        
        private var radius:Number = 150;
        private var angle:Number = 1;
        private var speed:Number = 0.05;
        
        private function render(event:Event):void
        {
            var textField:TextField;
            var i:int;
            var len:int = text.length;
            var radian:Number;
            var _angle:Number;
            
            for (i = 0; i < len; i++)
            {
                _angle = (angle + i) * 8;
                radian = Math.PI / 180 * _angle;
                textField = textFieldList[i];
                textField.x = Math.cos(radian) * radius;
                textField.z = Math.sin(radian) * radius * -1;
                textField.y = i * 4 + angle * 4 - 300;
                textField.rotationY = Math.atan2(textField.z * -1, textField.x) * 180 / Math.PI - 100;
                
                if (i == 0)
                {
                    trace(textField.z)
                }
                
                textField.alpha = Math.sin(radian);
                textField.alpha = textField.alpha < 0.6 ? 0.6 : textField.alpha;
            }
            
            angle += speed;
            
            container.rotationX += (stage.mouseY - stage.stageHeight / 2 - container.rotationX) * 0.1;
            speed += ((stage.mouseX - stage.stageWidth / 2) * 0.001 - speed) * 0.5;
        }
    }
}