Walter
03-31-2008, 06:15 PM
I'm attempting to have an embedded font be displayed as the textfield on a combobox. But it's spotty, at best.
Some fonts work - like Arial Black. However, Arial Black quits working on the combobox if I deactivate it on my machine. But it still works on textfields!
Then other fonts don't work on comboboxes even if they're active - like Brush Script. (Note - Brush Script on my machine is an otf file, whereas Arial Black is a ttf.)
To make matters more confusing, when the combobox's font is working, the font styling is lost when the combobox's enabled property is set to false! Argh!
Anyone know what I'm doing wrong? Is this just a bug? Will I have to write custom comboboxes?
Zip file available here (http://waltercoots.com/cb_test.zip). I tried uploading to the forum, but it was too big.
package com.adventure
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.Font;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import fl.controls.ComboBox;
import fl.data.DataProvider;
public class Main extends Sprite
{
private static var Reaction:FFFReaction = new FFFReaction();
/*
Note that FFFReaction was the
original font I was working with. I changed
the font in the library to Arial Black and Brush Script
for testing purposes, but didn't change any linkage or code
*/
private var textStyle:TextFormat = new TextFormat();
private var textLabel:TextField = new TextField();
private var combo:ComboBox = new ComboBox();
private var dp:DataProvider = new DataProvider();
public function Main()
{
textStyle.font = Reaction.fontName;
textStyle.color = 0xFF00FF;
with(textLabel)
{
embedFonts = true;
autoSize = TextFieldAutoSize.LEFT;
antiAliasType = AntiAliasType.ADVANCED;
defaultTextFormat = textStyle;
text = "Bear Hello.";
}
with(combo)
{
prompt = "I AM A COMBOBOX";
x = 45;
y = 100;
width = 150;
height = 25;
textField.setStyle("textFormat", textStyle);
}
dp.addItem({label:"One"});
dp.addItem({label:"Two"});
dp.addItem({label:"Three"});
dp.addItem({label:"Four"});
combo.dataProvider = dp; // Tried before and after items were added; no apparent difference
// combo.enabled = false;
addChild(textLabel);
addChild(combo);
}
}
}
Some fonts work - like Arial Black. However, Arial Black quits working on the combobox if I deactivate it on my machine. But it still works on textfields!
Then other fonts don't work on comboboxes even if they're active - like Brush Script. (Note - Brush Script on my machine is an otf file, whereas Arial Black is a ttf.)
To make matters more confusing, when the combobox's font is working, the font styling is lost when the combobox's enabled property is set to false! Argh!
Anyone know what I'm doing wrong? Is this just a bug? Will I have to write custom comboboxes?
Zip file available here (http://waltercoots.com/cb_test.zip). I tried uploading to the forum, but it was too big.
package com.adventure
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.Font;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import fl.controls.ComboBox;
import fl.data.DataProvider;
public class Main extends Sprite
{
private static var Reaction:FFFReaction = new FFFReaction();
/*
Note that FFFReaction was the
original font I was working with. I changed
the font in the library to Arial Black and Brush Script
for testing purposes, but didn't change any linkage or code
*/
private var textStyle:TextFormat = new TextFormat();
private var textLabel:TextField = new TextField();
private var combo:ComboBox = new ComboBox();
private var dp:DataProvider = new DataProvider();
public function Main()
{
textStyle.font = Reaction.fontName;
textStyle.color = 0xFF00FF;
with(textLabel)
{
embedFonts = true;
autoSize = TextFieldAutoSize.LEFT;
antiAliasType = AntiAliasType.ADVANCED;
defaultTextFormat = textStyle;
text = "Bear Hello.";
}
with(combo)
{
prompt = "I AM A COMBOBOX";
x = 45;
y = 100;
width = 150;
height = 25;
textField.setStyle("textFormat", textStyle);
}
dp.addItem({label:"One"});
dp.addItem({label:"Two"});
dp.addItem({label:"Three"});
dp.addItem({label:"Four"});
combo.dataProvider = dp; // Tried before and after items were added; no apparent difference
// combo.enabled = false;
addChild(textLabel);
addChild(combo);
}
}
}