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.text random1

Get Adobe Flash player
by feti 15 May 2009
    Embed
/**
 * Copyright feti ( http://wonderfl.net/user/feti )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ucSN
 */

package {
    import flash.display.*;
    import flash.text.*;
    import flash.events.*;
    import flash.net.*;
	
    [SWF(width=600, height=600, frameRate=30, backgroundColor=0x000000)]
    
    public class randomText extends Sprite {
        private var time:int
        private var tf:TextField
             
        private var textArrayNum:int;
        private var textArray:Array=['hellow newWorld!! this is aN as3 test!!',
         'こんにちは〜〜 今日は昨日寝たから眠くないです。',
         'var text1:RandomText = new RandomText(tf2, "CANADA");',
         '久しぶりの投稿かもしれない。',
         'Book report ideas for all grade levels. ... Web E',
         'アルゴニズム的にもそこまで難しい事をしていないので',
         ' Nuclear Energy Policy in Japan -',
         'この記事へのトラックバック アドレス',
         'Justis - Data Coverage - E',
         'そうそう、AS3.0を触りだして',
         'nnexes (English). Gulf Co-operation Co',
         '最初、長さとかも変えられるようにしようかなと思ったのですが',
         ];
         
         private var rightStr:String='';
         private var fakeTxt:String = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@%&$#_?!/-';

        private var i:int;
        private  var rightNum:int;
        private var timer:int;

        public function randomText() {
            // write as3 code here..
            tf=new TextField();
            tf.defaultTextFormat = new TextFormat('Osaka',60,0xffffff);
            tf.autoSize='left';
            
            tf.text='';
            tf.width=400
            tf.wordWrap=true
            tf.autoSize='left';
            tf.x=20;
            tf.y=30;
            
            
            addChild(tf)
            addEventListener(Event.ENTER_FRAME,ef)
                      
        }
        private function ef(event:Event):void{
            time++
            tf.text=rightStr;
            for (i=0; i<textArray[textArrayNum].length-rightNum; i++) {
		tf.appendText(fakeTxt.charAt(Math.floor(Math.random() * fakeTxt.length)));
	}
	if (timer>0) {
		timer=0;
		if (rightNum<textArray[textArrayNum].length) {
			rightNum++;
			rightStr=textArray[textArrayNum].substring(0,rightNum);
		} else {
			//removeEventListener(Event.ENTER_FRAME,randomText);
			rightNum=0;
			rightStr='';
			if (textArrayNum+1==textArray.length) {
				textArrayNum=0;
			} else {
				textArrayNum++;
			}
		}
	}
	timer++;
        }      
        
    } 
}