author: tantrum [+], Submitted: 04.25.06 11a
Avg. Rating: 4

usage

msg1 { q5_mike [+], posted: 05.14.06 9a•-, top [^] }
This is excellent, just what i was looking for, one comment though

How can you make the letters cycle from left to right or right to left instead of this one which picks up a random position?

Mike
msg2 { CoDo [+], posted: 05.21.06 1a•-, top [^] }
Very nice!
Thank you.

I also have question.
It works great when my dynamic text field is horizontal.
But when I rotate it 90 degrees the letters do not appear anymore.

Do you know how I can fix this??

Thanks again,

Cor
msg3 { tantrum [+], posted: 05.21.06 1a•-, top [^] }
embed font.
msg4 { CoDo [+], posted: 05.21.06 1a•-, top [^] }
Your good!

Thank you!!!!!!!
msg5 { tantrum [+], posted: 05.21.06 1a•-, top [^] }
i try my best. u r very welcome =)
msg6 { CoDo [+], posted: 05.21.06 6a•-, top [^] }
Hi Tantrum,

Can I ask you a question about another text issue I have?

I have a Flashform on my site that generates an email.
It works OK, but the output is one long string.
I would like to add a newline to every item I put out to the mailclient.
I tried chr(10) & chr(13), newline, Enter, Return even UDF A000 & F000.
But nothing seems te work.

Any suggestions?

Thanks,
Cor

Excuse my poor english, I am Dutch...
msg7 { q5_mike [+], posted: 05.24.06 10a•-, top [^] }
have you tried this:

myMovieClip.htmlText = "I want the next line" + "\n";
msg8 { LabRatz [+], posted: 05.25.06 10p•-, top [^] }
Hey Tantrum,
Maybe a little weird, but I am building an CMS prototype with flash frontend and php backend. Now the problem I have is that this script does not find the ','. So the cycling letters keep on searching for this one and causes the text not to be displayed correctly. Could you help me out?

I have the following code fixed up...

//your prototype
TextField.prototype.CycleLetters = function(targetText:String, speed:Number): Void {
var me:TextField = this;
var i:Number = 0;
///////////////////////////////////////////////// build letters array
var letters:Array = Array();
var numbers:Array = Array(0,1,2,3,4,5,6,7,8,9);
var chars:Array = Array();

for(i=0; i<targetText.length; i++) {
var myChar:String = targetText.substr(i, 1);
if (chars.toString().indexOf(myChar) == -1) chars.push(myChar);
}
chars = chars.sort();
letters = chars.concat(numbers);
///////////////////////////////////////////////// build random text first
i = 0;
var intervalId1:Number = setInterval(function () {
me.text += letters[random(letters.length)];
i++;
if (i>=targetText.length) {
clearInterval(intervalId1);
///////////////////////////////////////////////// start looping through chars until they all match
var intervalId2 = setInterval(function () {
var currentText:String = me.text;
var newText:String = "";
var letter:String = "";

for(i=0; i<=currentText.length; i++) {
if (currentText.substr(i, 1) != targetText.substr(i, 1)) {
letter = letters[random(letters.length)];
newText += letter;
} else {
newText += currentText.substr(i, 1);
}
}
me.text = newText;
if (targetText == newText) {
clearInterval(intervalId2);
}
updateAfterEvent();
}, speed);
/////////////////////////////////////////////////
}
updateAfterEvent();
}, speed);
};

/////my prototype
System.useCodepage=true;
Field1.html=true;
myLoadVar = new LoadVars ();
myLoadVar.load("page.php?id=1");
myLoadVar.onLoad = function (success){
if (success == true) {
//Field1.htmlText=myLoadVar.myText; testing if text shows up in box...which it does...
Field1.CycleLetters(myLoadVar.myText, 0.5);
}
}


Am I missing something?
msg9 { irok [+], posted: 05.30.06 5p•-, top [^] }
txtTest.CycleLetters("I AIN'T NO HOLLABACK GIRL", 20)

How do i add a newline? eg. <br> of html
msg10 { q5_mike [+], posted: 06.27.06 7a•-, top [^] }
I have this movie with this script applied. Problem is when i switch to load another movieclip dynamically while the letter cycles, the whole movie hangs and produces a script error. I'm guessing to be able to stop this i should execute a clearInterval function before i load a new movieclip but i dont know how to target the script you made can you please help me find a solution for this? Thanks.
msg11 { victor_tristan [+], posted: 07.20.06 1p•-, top [^] }
Check this!! .. i tested it! and i can use "," :D


//actionscript 2.0 required
//flash 8 player

TextField.prototype.CycleLetters = function(targetText:String, speed:Number):Void {
var me:TextField = this;
var i:Number = 0;
///////////////////////////////////////////////// build letters array
var letters:Array = Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", ",", "!", "?", " ");
var numbers:Array = Array(0,1,2,3,4,5,6,7,8,9);
var chars:Array = Array();

for(i=0; i<targetText.length; i++) {
var myChar:String = targetText.substr(i, 1);
if (chars.toString().indexOf(myChar) == -1) chars.push(myChar);
}
chars = chars.sort();
//letters = chars.concat(numbers);
///////////////////////////////////////////////// build random text first
i = 0;
var intervalId1:Number = setInterval(function () {
me.text += letters[random(letters.length)];
i++;
if (i>=targetText.length) {
clearInterval(intervalId1);
///////////////////////////////////////////////// start looping through chars until they all match
var intervalId2 = setInterval(function () {
var currentText:String = me.text;
var newText:String = "";
var letter:String = "";

for(i=0; i<=currentText.length; i++) {
if (currentText.substr(i, 1) != targetText.substr(i, 1)) {
letter = letters[random(letters.length)];
newText += letter;
} else {
newText += currentText.substr(i, 1);
}
}
me.text = newText;
if (targetText == newText) {
clearInterval(intervalId2);
}
updateAfterEvent();
}, speed);
/////////////////////////////////////////////////
}
updateAfterEvent();
}, speed);
};

txtTest.CycleLetters("vete a la mierda ok??, jo!", 20);
msg12 { mikehins [+], posted: 08.07.07 6p•08.07.07 6p, top [^] }
var intervalId1:Number = setInterval(function (){
me.text = ""; // fix bug I had...
me.text += letters[random(letters.length)];
msg13 { boydexter [+], posted: 06.12.08 3a•-, top [^] }
Hi all,

This is a fantastic script!! Just have a quick question, Mike posted on this forum and asked if the text could rotate from left to right, does anyone know how to do this?

At the moment the cycling letters randomly change but not from left to right.

I hope someone can help me :)

Thanks in advance!!!
msg14 { boydexter [+], posted: 06.12.08 7a•-, top [^] }
Anyone able to help???