AlexCooper, аа, дефолт формат... спасибо, идею понял.
Шрифт наверное все-таки
Verdana имелся ввиду.
Ок, переделал код так:
Код AS3:
package
{
import flash.display.*;
import flash.text.*;
import flash.events.*;
public class MouseTrigger extends Sprite
{
private var text1:TextField;
private var text2:TextField;
private var format1:TextFormat;
private var format2:TextFormat;
private var clickCounter:uint = 0;
private var overCounter:uint = 0;
public function MouseTrigger()
{
textInit();
mouseInit();
}
private function textInit()
{
//--- MouseClick textfield ---//
format1 = new TextFormat();
format1.color = 0xCCCC00;
format1.font = "Verdana";
format1.size = 25;
text1 = new TextField();
text1.text = "MouseClick";
text1.x = 50;
text1.y = 50;
text1.selectable = false;
// text1.embedFonts = true;
text1.autoSize = TextFieldAutoSize.LEFT;
text1.defaultTextFormat = format1;
addChild(text1);
//--- MouseOver textfield ---//
format2 = new TextFormat();
format2.color = 0x00CCCC;
format2.font = "Verdana";
format2.size = 25;
text2 = new TextField();
text2.text = "MouseOver";
text2.x = 50;
text2.y = 150;
text2.selectable = false;
// text2.embedFonts = true;
text2.autoSize = TextFieldAutoSize.LEFT;
text2.defaultTextFormat = format2;
addChild(text2);
}
private function mouseInit()
{
text1.addEventListener(MouseEvent.CLICK, clickTrigger);
text2.addEventListener(MouseEvent.MOUSE_OVER, overTrigger);
}
private function clickTrigger(e:MouseEvent)
{
clickCounter ++;
text1.text = "MouseClick: triggered " + String(clickCounter) + " times";
}
private function overTrigger(e:MouseEvent)
{
overCounter ++;
text2.text = "MouseOver: triggered " + String(overCounter) + " times";
}
}
}
Строки с embedFonts закаментировал, потому-что, с ними, получается вообще ПУСТОЙ ЭКРАН (почему?)
Однако, и в такой реализации возникает симметрично-противоположный перекос.
Теперь до нажатия кнопок мы имеем стандартный системный формат, и только после нажатия он изменяется в defaultTextFormat.