This content has been marked as final. Show 8 replies
OK, first - do you have an instance name of 'energyLevel' assigned to the textField? Second you do not need to create a TextFormat just call:
energyLevel.textColor = 0xFF0000;
Also, you must have an MC with the instance name 'actor' that is instantiated on the timeline by the time you call the 'onEnterFrame' function.
I guessing you are missing the instance names.
The suggestions you made had been done. After further tinkering (and using only .textColor as you suggested), I found that the problem was that the instance name needs to be different from the variable associated with field in the properties window (they had both been called energyLevel). Once I made one different, this worked. Thanks for your assistance along the way.
PS: Since About Flash 6, I think most of us do not use the variables with text fields. It is much preferred to assign the .text property and just leave the var blank.
For sure Rothrock, and you're welcome .Michael.
@Rothrock - btw did you see my last post at that other Q about the tab shortcut, just wanted to make sure, that you know those comments weren't directed your way :)
I understand what you both said about using .text instead of the variable, but what advantage does that give you? Just one less variable?
Also, if a dynamic text field holds a number and you need to do math periodically on that number, isn't it just easier to have:
amountLeft = amountLeft - (AmountFraction*.332)
amountLeftField.text = amountLeft - (AmountFraction*.332)
in which case you'd have another variable anyway?
not exactly, read: HERE
What if you are tracking a value that you don't want to display at the time, or want use it in other calculations. Also there are a few other ways to enter what you've got there, as in:
amountLeftField.text -= AmountFraction*.332;
OR how about ...
a_txt.text -= f*.332;
Flash recognizes operations on a numerical value entry, performs the calc, and still displays as a String.
Additionally, if you use the underscore with an extention name for instance naming as in 'my_txt', Flash will recognize the extention and bring up a list of methods, properties and event handlers related to the data type when you type 'dot' after, if you have the 'code hints' preference turned on. Same with _mc, _btn, _ldr, _ti, _cb, ... etc. good for learning, and as you type the next few characters of the prop, the list will highlight the prop, and you can hit 'enter' to complete the rest, handy.
I'm not certain, but I believe that the TextField Var property has been eliminated entirely in AS3. (?)
OK - thanks for your additional insight!
you're welcome :)