Skip to main content
Energetic_Captain154A
Inspiring
December 5, 2012
Answered

Fade in letter by letter...

  • December 5, 2012
  • 1 reply
  • 1318 views

Hello,

does any have idea if is possible make flash fade in letter by letter animation? I'm talking about animation from 0% to 100% alpha (in for example six frames), not just simple loading letter after letter from some text. Not sure if it's possible to touch specific character in text area and somehow edit alpha of it.

I'll be glad for any advices, thanks : )

Have a nice day

This topic has been closed for replies.
Correct answer kglad

embed a font, assign it a linkage id (eg, ArialRegID) and you can use:

import mx.transitions.Tween;

import mx.transitions.easing.None;

var tfor:TextFormat = new TextFormat();

tfor.color = 0xff0000;

tfor.size = 14;

tfor.font = "ArialRegID";

var parent_mc:MovieClip = this.createEmptyMovieClip("parent_mc",this.getNextHighestDepth());

fadeTextF("this is text to fade",parent_mc,tfor,1,.1,5,20,10);  // do not change any code except in this line where you assign the parameters for your fade and the textformat you want applied to your text.

function fadeTextF(s:String,mc:MovieClip,tfor:TextFormat,fadeRate:Number,displayRate:Number,letterSpacing:Number,x:Number,y:Number):Void{

    var prevX:Number = 0;

    var a:Array = s.split("");

    for(var i:Number=0;i<a.length;i++){

        var tf:TextField = mc.createTextField("tf_"+i,i,prevX,y,10,10);

        tf.embedFonts = true;

        tf.autoSize = "left";

        tf.multiline = false;

        tf.text = a;

        tf.setTextFormat(tfor);

        tf._alpha = 0;

        prevX+=tf._width+letterSpacing;

        setTimeout(function(tf:TextField){new Tween(tf, "_alpha", None.easeNone, 0, 100, fadeRate, true);},displayRate*i*1000,tf);

    }

    mc._x = x;

    mc._y = y;

}

p.s. please mark helpful/correct responses.

1 reply

kglad
Community Expert
Community Expert
December 5, 2012

yes. 

do you want to use the timeline or actionscript to fade the letters?

if the timeline, are you using static or dynamic text?

Energetic_Captain154A
Inspiring
December 5, 2012

Well actionscript will be more fitting for my purpose here. So i want use actionscript.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
December 5, 2012

embed a font, assign it a linkage id (eg, ArialRegID) and you can use:

import mx.transitions.Tween;

import mx.transitions.easing.None;

var tfor:TextFormat = new TextFormat();

tfor.color = 0xff0000;

tfor.size = 14;

tfor.font = "ArialRegID";

var parent_mc:MovieClip = this.createEmptyMovieClip("parent_mc",this.getNextHighestDepth());

fadeTextF("this is text to fade",parent_mc,tfor,1,.1,5,20,10);  // do not change any code except in this line where you assign the parameters for your fade and the textformat you want applied to your text.

function fadeTextF(s:String,mc:MovieClip,tfor:TextFormat,fadeRate:Number,displayRate:Number,letterSpacing:Number,x:Number,y:Number):Void{

    var prevX:Number = 0;

    var a:Array = s.split("");

    for(var i:Number=0;i<a.length;i++){

        var tf:TextField = mc.createTextField("tf_"+i,i,prevX,y,10,10);

        tf.embedFonts = true;

        tf.autoSize = "left";

        tf.multiline = false;

        tf.text = a;

        tf.setTextFormat(tfor);

        tf._alpha = 0;

        prevX+=tf._width+letterSpacing;

        setTimeout(function(tf:TextField){new Tween(tf, "_alpha", None.easeNone, 0, 100, fadeRate, true);},displayRate*i*1000,tf);

    }

    mc._x = x;

    mc._y = y;

}

p.s. please mark helpful/correct responses.