Array, change color, as3
Posted
by pixelGreaser
on Stack Overflow
See other posts from Stack Overflow
or by pixelGreaser
Published on 2010-05-12T17:47:14Z
Indexed on
2010/05/12
18:14 UTC
Read the original article
Hit count: 214
flash
|actionscript-3
Hi
Thanks for the help Yesterday, but I have on more question. How can I change color of text on certain words?
My animation plays the text animation of THIS SALE IS RED HOT!!! I want RED HOT it to be red. It seems the array can be indexed in such a way to switch the color from Blue to Red.
MY BANNER ADD
var myArray:Array = ["THIS","SALE","IS","RED HOT!!!",];
var tm:Timer = new Timer(500);
tm.addEventListener(TimerEvent.TIMER, countdown);
function countdown(event:TimerEvent) {
tx.text = myArray[(tm.currentCount-1)%myArray.length];
}
tm.start();
tx.textColor = 0x0000FF;
Cont...PSEUDO CODE
//var myArray:Array = ["This","Sale","is","RED HOT!!!",];
var spliceRedhot = myArray.splice(-1);
//trace(myArray[2]);
trace(spliceRedhot);
function mySplice(e:Event):void{
if (spliceRedhot = 4){
//Make RED HOT!!! red
tx.textColor = 0xFF0000;
}
else{
//Text is Blue again
tx.textColor = 0x0000FF;
}
}
© Stack Overflow or respective owner