In Flash when you set text in a TextField object with the htmlText property, changing the alpha value no longer works. Is there a way around that?
Dynamic text doesn't support the alpha property (among others). I assume setting it to HTML text imposes the same limits. One way I've found around this is to contain the text field in a movie clip and set the alpha on the movie clip instead.
If you find that a text field isn't responding to the alpha
property, it's probably because you haven't embedded the font. Make sure that you click "Embed..." in the textfield's properties and select, say, "Basic Latin".
If you find that your htmlText
formatting (e.g. <b>
and <i>
) aren't showing up, you must make sure that those (styled) fonts are also embedded. An easy way to do this is to create hidden or off-stage dynamic textfields with the styles you need (be sure to embed the font too!)
You can do this without embedding the font by using the blendMode, with a minor sacrifice in text appearance (I believe).
import flash.display.BlendMode;
import flash.text.TextField;
// later...
var tf:TextField = new TextField();
tf.blendMode = BlendMode.LAYER;
tf.alpha = 0.5;
Some confusion here.
Whether alpha works or not depends on whether the text field uses device fonts, not whether it uses HTML. (Device fonts are used any time you have a dynamic/input text and you don't embed the font.)
If possible, simply publish for Flash player 10, which now supports alpha for device fonts. (Note that you have to set the
alpha
property of the textfield or its parent - choosing a transparent color for the text itself doesn't work.)Fallback option for v8-9 is to force bitmap caching by applying a filter. For example, you could use a drop shadow with the color set to be transparent. This causes Flash to render the text field into a bitmap before drawing it to the screen, so your alpha is applied to the bitmap and everything works.
For player version 7 or lower, there's no way to get alpha for device fonts. You have to either embed the font or learn to live without alpha. :D