11-20-2010 11:47 AM
Apparently the alpha setting of a Label control does not work in the simulator:
var label :Label = new Label(); label.x = 10; label.y = 10; label.text = 'HELLO'; label.alpha = 0.20; label.format = new TextFormat( 'Arial', 18, 0xFFFFFF ); this.addChild( label );
As a normal AIR application, it looks like this:
In the simulator, it looks like this:
Bug or feature?
11-20-2010 11:53 PM
This is a feature of Flash Player.
You can' t use alpha, mask or rotation when the TextField (used in Label) renders the text with system fonts.
You need to embed fonts in class definition like this:
[Embed(systemFont="Arial", fontName="Arial", mimeType="application/x-font", embedAsCFF="false")] private static var font:Class;
and set the embedFonts on Label to true:
label.embedFonts = true;
You can get more info on embedding fonts at:
11-21-2010 09:19 AM - edited 11-21-2010 09:20 AM
I will try embedding the font to test, but it works fine outside the simulator, so I dont think it is a function of Flash. I know if you want to rotate text, you have to embed, but not to change the alpha.
11-22-2010 01:43 PM
John-
Did you get this to work? I am also having this problem.
11-22-2010 02:12 PM
No, I have not given it a try (embedding a font). I should not have to embed the system font to make a label semi-transparent via the alpha attribute. If you have time, please give it a shot, otherwise, I will try it later on today.
11-22-2010 02:49 PM
I can confirm this works:
var l1:Label = new Label();
l1.text = "test1";
addChild(l1);
[Embed(systemFont="Arial", fontName="Arial", mimeType="application/x-font", embedAsCFF="false")]
var font:Class;
var l2:Label = new Label();
l2.y=30;
l2.alpha=.2;
l2.text = "test2";
l2.embedFonts=true;
l2.format =new TextFormat("Arial");
addChild(l2);
Renders as follows:
11-22-2010 03:20 PM
Great.
Have you been able to do it with the system (BB) font?
11-22-2010 03:42 PM
unfortunately no...this does not work ![]()
I will keep trying things and hopefully have a solution soon
11-22-2010 03:47 PM
Very odd that one embedded font would work and another (system font) would not.
Can't wait to hear what you find out.
11-22-2010 06:44 PM
Assuming things work like they did years ago when I did Flash (before Flex came along), font embedding embeds the font as a shape. Therefore it's not being rendered as text, but by drawing a shape like any other. That might explain the differences. The fact that you don't have the BB fonts installed on the computer you're compiling on would be why they don't embed properly.
Of course it's possible Adobe uses a more sophisticated font embedding system these days, but this was how it worked several years ago. Wouldn't be surprised if it's still true today.