PDA

View Full Version : Cycling Text Updated



stereochris
March 3rd, 2006, 12:44 AM
Hey - I wanted to come up with a better way to cycle through text, like the way thats listed in the tutorials somewhere. I didn't want to have to duplicate movieclips, and I didn't want the letters to appear out of order. I think I came up with something pretty good, but I bet it can be improved upon...




_root.onLoad = function() {
text = "BEATBOX INDUSTRIES TWO THOUSAND SIX";
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWQXYZ ";
letters = new Array();
i = 0;
}
_root.onEnterFrame = function() {
if (i < text.length) {
_root["letter"+i] == text.charAt(i) ? _root["letter"+i] = text.charAt(i) : _root["letter"+i] = alphabet.charAt(random(alphabet.length));
letters[i] = _root["letter"+i];
_root["letter"+i] == text.charAt(i) ? i++ : null;
_root["letter"+i] = alphabet.charAt(random(alphabet.length));
_root.text_txt.text = letters.join("");
}

if (Key.isDown(Key.CONTROL)) {
trace(text.length);
delete(letters);
letters = new Array();
text = text_2;
i = 0;
}
}

Pasquale
March 3rd, 2006, 02:47 AM
comes up with undefined :S?

stereochris
March 3rd, 2006, 08:16 AM
comes up with undefined :S?

I'm not sure why, I'm on a different computer now and viewed the SWF and it still worked fine... dunno

Seb Hughes
March 3rd, 2006, 08:27 AM
comes up with undefined :S?
I get that too.

stereochris
March 3rd, 2006, 08:40 AM
I get that too.

any idea why thats happening? anyone? :h:

simplistik
March 3rd, 2006, 09:11 AM
it could be because you're tryin to use text as a variable when it's reserved. i don't know though since I can't open the .fla but that's what it looks like from the code above

ie.


text = "BEATBOX INDUSTRIES TWO THOUSAND SIX";

change it and all other instances that you're using it to:


yourtext = "BEATBOX INDUSTRIES TWO THOUSAND SIX";

Templarian
March 3rd, 2006, 09:14 AM
works for me.

(IE, at school).
What flash version are you exporting it in?

simplistik is right but some flash players will still let the reserved word to be used.

jimhere
March 3rd, 2006, 10:52 AM
Works pretty well in Safari...

LoC
March 3rd, 2006, 05:24 PM
Looks pretty good but tests your patience a bit by being a bit on the slow side. Having upper and lowercase would test you patience even more...

DDD
March 3rd, 2006, 06:55 PM
I dont get it :?: I put in text and nothing happened

H4T
March 4th, 2006, 01:01 AM
Same here....undefined error...

gonzales
March 4th, 2006, 03:20 AM
works for me: safari.

Seb Hughes
March 4th, 2006, 07:01 AM
Works in Ie, but not FF.

unclesond
March 9th, 2006, 12:47 PM
Works fine for me in FF - Seems a bit of a confusing one