※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!

wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)

 notice: Flash editor updated! Join the development! Thanks to MiniBuilder


FORKED
  1. // forked from seyself's MultilineText
  2. package
  3. {
  4. import caurina.transitions.Tweener;
  5. import flash.display.Sprite;
  6. import flash.text.TextField;
  7. import flash.text.TextFormat;
  8. [SWF(width="465", height="465", backgroundColor="0x000000", frameRate="30")]
  9. public class MultilineText extends Sprite
  10. {
  11.     public function MultilineText() 
  12.     {
  13.         var tf:TextField = new TextField();
  14.         tf.defaultTextFormat = new TextFormat("_georgia"14, 0xFFAA88, """italic");
  15.         tf.width = stage.stageWidth;
  16.         tf.height = stage.stageHeight;
  17.         //tf.mouseEnabled = false;
  18.         tf.multiline = true;
  19.         //tf.wordWrap = true;
  20.         tf.text = getText();
  21.         tf.autoSize = "left";
  22.         
  23.         addChild(tf);
  24.         
  25.         showText(tf);
  26.     }
  27.     
  28.     public function showText(target:TextField):void
  29.     {
  30.         var lines:Array = target.text.split("\r");
  31.         var n:uint = Math.min(lines.length, 40);
  32.         var str:String = "";
  33.         for (var i:uint = 0; i < n;i++ )
  34.         {
  35.             str += "\r";
  36.             Tweener.addTween( 
  37.             {
  38.                 index      : 0,
  39.                 rows       : i,
  40.                 target     : target,
  41.                 text       : lines[i]
  42.             }, 
  43.             {
  44.                 index      : lines[i].length,
  45.                 time       : 1.4,
  46.                 delay      : i * 0.25 + 4,
  47.                 transition : "easeoutsine",
  48.                 onComplete : function():void
  49.                 {
  50.                     
  51.                 },
  52.                 onUpdate   : function():void
  53.                 {
  54.                     updateHandler(this);
  55.                 }
  56.             });
  57.         }
  58.         target.text = str;
  59.     }
  60.     
  61.     private function updateHandler(info:Object):void
  62.     {
  63.         var tf    :TextField = info.target;
  64.         var str   :String    = info.text;
  65.         
  66.         var begin :int       = tf.getLineOffset(info.rows);
  67.         var end   :int       = begin + tf.getLineLength(info.rows) - 1;
  68.         
  69.         tf.replaceText(begin, end, str.substr(0, info.index));
  70.     }
  71.     
  72.     private function getText():String
  73.     {
  74.         return String(<![CDATA[
  75.         
  76.       I can write whatever I want right here! Awesomeness...
  77.       I can write whatever I want right here! Awesomeness...I can write whatever I want right here! Awesomeness...
  78.       I can write whatever I want right here! Awesomeness...
  79.       I can write whatever I want right here! Awesomeness...
  80.       I can write whatever I want right here! Awesomeness...
  81.       I can write whatever I want right here! Awesomeness...
  82.       I can write whatever I want right here! Awesomeness...
  83.       I can write whatever I want right here! Awesomeness...
  84.     
  85.         ]]>);
  86.     }
  87. }
  88. }
noswf
Get Adobe Flash Player