Hi,

As you cannot apply _alpha property to a dynamic textfield, here I suggest a 
workaround solution. By changing the text color from white to black, it will 
look like fade in. There might be better solution to this problem. Here under 
is my code: (I modified the whole fadin function and code lines with "####" 
comments)

[CODE]

var fadeInSpeed = 10;   // fade in speed

MovieClip.prototype.FadeIn = function (txt) {
        this.onEnterFrame = function ()
        {
                var myformat:TextFormat = new TextFormat();
                this.R >this.nR  ? this.R -= fadeInSpeed : this.R = this.nR;
                this.G >this.nG  ? this.G -= fadeInSpeed : this.G = this.nG;
                this.B >this.nB  ? this.B -= fadeInSpeed : this.B = this.nB;
                var RGB = "0x" + this.R.toString(16) + this.G.toString(16) + 
this.B.toString(16);
                myformat.color = RGB;
                txt.setTextFormat(myformat);
        };
};


function randomBetween (a, b)
{
        return Math.min (a, b) + random (Math.abs (a - b) + 1);
}

var textMessage = "blah <br>blah blah blah blah blah blah blah blah blah blah 
<br /> blah balh"; 
var positioning = 20; 
var letterSpacing = 10; 
for (i = 0; i < textMessage.length; i++) {
        var mc = letterDuplicate.duplicateMovieClip ("letterDuplicate" + i, i);
        mc._x = positioning;
        
        //test code
        mc.WhatLetter.html = true;
        mc.WhatLetter.htmlText = textMessage.charAt (i);
        mc.R = mc.G = mc.B = 255;               // #### starting RGB value
        mc.nR = mc.nG = mc.nB = 0;              // #### final RGB value you want

        //test code
        
        //mc.WhatLetter.text = textMessage.charAt (i);
        mc.FadeIn (mc.WhatLetter);              // #### passing its textfield 
object to fadein function
        // #### You can remove the parameter if you hardcode your fadeIn 
function 
        // ####  to read "this.WhatLetter" instead of "txt" parameter
        
        positioning += letterSpacing;
}


If my understanding of your MC structure and layout is right, this code should 
work.


Cheers!!!

[...]   Sam Liu
Flash Developer - Languages Online
Office of Learning and Teaching
Department of Education and Training
 

T:  (03) 9637 2102    F:  (03) 9637 2060

 





-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter
Sent: Thursday, 20 October 2005 8:15 AM
To: [email protected]
Subject: [Flashcoders] dynaimc text animation


Hello boys its glad to have everyone back. I missed the list. Anyway enough 
with the mushy stuff...

I am trying to figure out how to get this nifty text effect to work. Below is 
the code: [code] MovieClip.prototype.FadeIn = function () {
        this._alpha = randomBetween (-200, 0);
        this.onEnterFrame = function ()
        {
                if (this._alpha < 100)
                {
                        this._alpha += 10;
                }
        };
};
function randomBetween (a, b)
{
        return Math.min (a, b) + random (Math.abs (a - b) + 1);
}
var textMessage = "blah <br>blah blah blah blah blah blah blah blah blah blah 
<br /> blah balh"; var positioning = 60; var letterSpacing = 30; for (i = 0; i 
< textMessage.length; i++) {
        var mc = textToDuplicate.duplicateMovieClip ("letterDuplicate" + i, i);
        mc._x = positioning;
        
        //test code
        mc.WhatLetter.html = true;
        mc.WhatLetter.htmlText = textMessage.charAt (i);
        //test code
        
        //mc.WhatLetter.text = textMessage.charAt (i);
        mc.FadeIn ();
        positioning += letterSpacing;
}
[code]

all the code is doing is duplicating out one dynamic text box with each letter 
in it and fading it randomly. How can I take this to the next level and get the 
code to know it needs to skip a line when it reaches a <br>. Is there an 
entirely different approach to this? Thanks!

Corban Baxter      |      rich media designer      |      www.funimation.com


_______________________________________________
Flashcoders mailing list
[email protected] 
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Important - 
This email and any attachments may be confidential. If received in error, 
please contact us and delete all copies. Before opening or using attachments 
check them for viruses and defects. Regardless of any loss, damage or 
consequence, whether caused by the negligence of the sender or not, resulting 
directly or indirectly from the use of any attached files our liability is 
limited to resupplying any affected attachments. Any representations or 
opinions expressed are those of the individual sender, and not necessarily 
those of the Department of Education & Training.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to