When you call addEventListener
, you need to pass in a function, not a function call:
highlightTextForDuration.addEventListener(TimerEvent.TIMER_COMPLETE, textDehighlight);
And your listener function needs to look more like this:
private function textDehighlight(e:TimerEvent):void{
var textField:RichText = textToChange;
textField.setStyle("color", "#00000");
}
Of course, that will require that you put a class variable for textToChange
. If that doesn't work, you can use an anonymous listener function:
highlightTextForDuration.addEventListener(TimerEvent.TIMER_COMPLETE, function(e:TimerEvent):void {
var textField:RichText = Texter;
textField.setStyle("color", "#00000");
});