views:

33

answers:

1

Hey, My text animation scrolls from left to right, which is OK. I want to keep it simple but change it up little. How do I get the text to go right to left? Thanks.

AS3 Example

mask = customMask;
var my_str:String = "     Ad hoc     ad loc     and     quid pro quo     ";
function addUm():void {
my_str = my_str.charAt(my_str.length - 1) + my_str.slice(0, my_str.length - 1);
trace(my_str);
txt.text = String(my_str);
}
var myInterval:uint = setInterval (addUm, 222);

AS2 Example

ms.setMask(r);
//MARQUEE TEXT STRING variable name 'my_str'
var my_str:String = "     Ad hoc     ad loc     and     quid pro quo     ";
setInterval(changeText,222);
function changeText () {
my_str = my_str.charAt(my_str.length - 1) + my_str.slice(0, my_str.length - 1);
trace(my_str);
_root.r.myStr = my_str;
}

Other Methods
Simple's good. Examples I've seen take 50 lines of code, and it's probably not necessary.

+1  A: 

You just need to change the line ,

my_str = my_str.charAt(my_str.length - 1) + my_str.slice(0, my_str.length - 1);

to

my_str =  my_str.substring(1,my_str.length) + my_str.charAt(0);

substring grabs the string consisting of the character specified by startIndex (1) and all characters up to endIndex - 1 (my_str.length).

phwd