I want to create a site in which all graphics, and user interface elements (text/form fields etc.) are skewed and rotated. So I’ve been experimenting a bit with dynamic textfields, and have gotten myself into serious problems!!!
It would seem that a rotated textfield need to have an embedded font in order to show, so I’ve created a font in the library, and given it a linkage identifier (“myfont”) for use with the textFormat() class.
Here’s the code for that part:
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "myfont";
my_fmt.color = 0xFFFFFF;
Next, I created the textfield itself (“my_txt”). It can contain HTML, so I also load an external stylesheet for the purpose of formatting the text:
var styleObj = new TextField.StyleSheet();
styleObj.load('style.css');
styleObj.onLoad = function(success) {
if (!success) {
setText(my_txt, "could not load CSS!");
} else {
setText(my_txt,str);
}
my_txt._visible = true;
};
Oh, and I set the embedFonts flag to true:
my_txt.embedFonts = true;
Now were getting to the part strange part… the setText() function seems to depend on commands in a certain order, to avoid problems with non-appearing text ? If I change the order of a single of these lines, the function refuse to work:
function setText(target, strText) {
target.htmlText = strText;
target.setTextFormat(my_fmt);
target.styleSheet = styleObj;
}
But worse is the [color=black]fact[/color] that I cannot set the text later on. The text simply disappear if the setText() function is called more than once.
Anybody ?