Avg. Rating 3.1

Problem

One solution making labels and textArea like the effect in Need for Speed menu's, You can see this in action at www.umbrellacorp.no

Solution

If someone do make a html version of this lett me know :) I have made a closed componet of if to, if someone would like to have it just send me an mail.

Detailed explanation

<?xml version="1.0" encoding="utf-8"?>
<!-- http://www.umbrellacorp.no -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initApp()">

 <mx:Script>
  <![CDATA[
   import mx.utils.ArrayUtil;
   
   [Bindable]
   private var tempMyText:String;
   
   private var textArea:String;
      
   public var myText:String = 'Umbrella - Corperation';
   
   private var posMyText:int;
   
   private var randText:String;  // myText mixedup done in iniApp.
      
   private var writerTimer:Timer;

   private function initApp():void{
    writerTimer = new Timer(1);
    writerTimer.start();
    writerTimer.addEventListener(TimerEvent.TIMER, timerHandler);
    
    posMyText = 0;
    
    randText = new String();
    textArea = new String();
    
    var i:int;
    for ( i = 0; i < myText.length; i++){
     randText += new String(myText.charAt(Math.floor(Math.random()*myText.length)));
    }
    tempMyText = new String(randText);
   }
   
   private function timerHandler(event:TimerEvent):void{
     
    if(myText.length > posMyText){
     textArea += myText.charAt(posMyText);
     posMyText++;      
    }else{
     writerTimer.stop();
    }

    var i:int;
    var list:Array = new Array();
    for ( i = posMyText; i < myText.length; i++){
     list.push(myText.charAt(Math.floor(Math.random()*myText.length)));
    }
    tempMyText = textArea + list.join('');   
   }    
  ]]>
 </mx:Script>

 <mx:TextArea text="{tempMyText}" width="684" height="261" fontWeight="bold" fontFamily="Arial" fontSize="25" textAlign="left" color="#ff0000"/>
 <mx:Button click="initApp()" label="run one more time" />
 
</mx:Application>

Report abuse

Related recipes