[RESOLVED] Fading dynamically created text in loops
Hi, I'm trying to fade my text in right after creating it and bringing the alpha down. I thought it would be as simple as declaring a conditional statement right after that, but obviously it's not. Then I have looked around and found different solutions that work in the root timeline like the one commented out in the code, but no luck... I can't achieve a thing.
I wonder if I can get this to work...
Code:
for (i=1; i<=5; i++) {
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Font 1";
my_fmt.size = 14;
my_fmt.color = 0xFFFFCC;
my_fmt.align = "center";
_root["menuButton"+i].createTextField("my_txt", getNextHighestDepth(), 0, 0, 160, 22);
_root["menuButton"+i].my_txt.embedFonts = true;
_root["menuButton"+i].my_txt.text = menuButtons[i];
_root["menuButton"+i].my_txt.setTextFormat(my_fmt);
_root["menuButton"+i].my_txt._alpha = 20;
What I first thought should work:
Code:
/*if (_root["menuButton"+i].my_txt._alpha<100) {
_root["menuButton"+i].my_txt._alpha += 5;
}*/
The example found
Code:
/*function fadeTheText() {
_root["menuButton"+i].onEnterFrame = function() {
if (_root["menuButton"+i].my_txt._alpha<100) {
_root["menuButton"+i].my_txt._alpha++;
trace(_root["menuButton"+i].my_txt._alpha);
} else {
delete _root["menuButton"+i].onEnterFrame; // done, we remove this function
}
}
}
fadeTheText();
}*/