Dynamic text

Hi

I got this scripting from one of your guys, but how do you apply it to a button, created in flash?

 myArray = ["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" , "'" , " "];
word = "hello it's me again ha ha ha";
for (i=0; i<word.length; i++) {
myClip = attachMovie("mc", "mc"+i, i);
myClip.ivar = i;
myClip._y = 100;
myClip._x = 0+myClip.ivar*myClip._width;
myClip.targ = word.charAt(myClip.ivar);
myClip.myText.text = myArray[random(myArray.length)];
myClip.counter =random(10)
myClip.onEnterFrame = change;
}
function change() {
this.counter++
if (this.myText.text != this.targ && this.counter<15) {
this.myText.text = myArray[random(myArray.length)];
} else {
this.myText.text = this.targ;
delete this.onEnterFrame;
}
}

 

Looks like something i might have done. have a look here http://www.kirupaforum.com/forums/showthread.php?t=65050 I made a few examples so you may find what you are looking for. If not, I`ll try and adapt it for you.

Yehm thats exactly what i’m looking for. that http://www.yugop.com/ thingie.

But I’ve created a button in flash, and want to add the script to my button, but don’t know how? When I open that flash file its only scripting. Sorry I know I sound dumb…
;(

Put the loop in a function

myArray = ["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", "'", " "];
word = "hello it's me again ha ha ha";
function makeRandomtext() {
	for (i=0; i<word.length; i++) {
		myClip = attachMovie("mc", "mc"+i, i);
		myClip.ivar = i;
		myClip._y = 100;
		myClip._x = 0+myClip.ivar*myClip._width;
		myClip.targ = word.charAt(myClip.ivar);
		myClip.myText.text = myArray[random(myArray.length)];
		myClip.counter = random(10);
		myClip.onEnterFrame = change;
	}
}
function change() {
	this.counter++;
	if (this.myText.text != this.targ && this.counter<15) {
		this.myText.text = myArray[random(myArray.length)];
	} else {
		this.myText.text = this.targ;
		delete this.onEnterFrame;
	}
}

and call that function with your button

on(release){
makeRandomtext();
}

scotty(-:

Thanks alot, its working now, but now I wanna know how they manage to change the width and put the “___” in at http://www.yugop.com/

thanks!:cap:

http://www.gifsrus.com/testfile/longbuton___.swf
Any nearer to what you want?

YEEEEEEEAAAAHH!!:party: How do you do that?

Its basically the same code as one of the attempts in the other post.

Thanx alot Stringy, got one problem though, the underscores doesn’t show. Why not?

 function startoff(lets, T) {
 myText.text = "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _";
 displaytext = lets;
 displayLength = lets.length;
 dupdisplaylength = 60
 myinterval = setInterval(messup, 20, T);
 counter =50
}
function messup(T) {
 mystring = "_";
 for (i=0; i<dupdisplayLength; i++) {
  b = displaytext.substr(random(displayLength), 1) != " " ? displaytext.substr(random(displayLength), 1) : "_";
  mystring += b;
 
 }
  if(dupdisplaylength>displaylength){
   dupdisplaylength--
  myString.slice(dupdisplaylength-1,dupdisplaylength)
  T.text = mystring.substr(0,dupdisplaylength);
 }
 
 counter--;
 if (counter==displayLength) {
  counter = 40;
  clearInterval(myInterval);
  myString = displaytext;
  T.text = mystring;
 }
}
myButton.onPress = function() {
 startoff(" welcome ", myText);
};
btn1.onPress = function() {
 startoff(" services ", myText);
};
btn2.onPress = function() {
 startoff(" contact us ", myText);
};