[SOLVED] Set Alpha Value of Text in TextField


(Ecen Cronzeton) #1

I want to set the alpha value of the text in a TextField in order to be able to tween the text in and out of visibility. However, simply using myTextField.alpha = 0.0 does not work: the text is still fully visible. After some searching I found out that this could be solved by setting the blendmode to LAYER, like so: myTextField.blendMode = BlendMode.LAYER, but this has not worked for me either, the result is the same.

So, does anyone know how to do this?


#2

i don’t know it this would it but set the alpha to straight 0 instead of 0.0 here a like with something simler


(Jacob Albano) #3

In as3, 0.0 is the exact same thing as 0. If you’re assigning to an int, it’ll be coerced to a number, and if you’re assigning to a number they’re semantically identical.


(Jacob Albano) #4

Do you mean a Text graphic? TextField is an actionscript class, not specific to Flashpunk.


(Ecen Cronzeton) #5

I do mean a TextField. The question seemed related so I thought I could ask it here, but perhaps proper is to ask it on another site.

Or perhaps there is a good FlashPunk specific way of showing text with transparency instead of drawing a TextField to a graphic object?


(Jacob Albano) #6

If you use the Text graphic you’ll definitely have a better time. What’s probably happening is that you’re changing the alpha on the text field without re-drawing it, so the Flashpunk graphic never updates to reflect the change.


(Ecen Cronzeton) #7

I’m quite sure I’m redrawing it! Changing the color works without a hitch, for example.

However, the Text graphic seems to work very well, with adjustable alpha and everything. Thanks!