【发布时间】:2014-09-18 15:06:04
【问题描述】:
我在舞台上有textInput,它不是组件;而是一个textField,它被设置为inputText。我在舞台上还有一个按钮,可以将inputField 中选定的文本部分加粗。
这是代码,运行良好:
var formatDefBold: TextFormat = new TextFormat();
formatDefBold.bold = false;
var formatBold: TextFormat = new TextFormat();
formatBold.bold = true;
boldBtn.addEventListener(MouseEvent.CLICK, makeBold);
function makeBold(event: MouseEvent):void
{
var sbi:Number = myInputField.selectionBeginIndex;
var sei:Number = myInputField.selectionEndIndex;
if (sbi != sei)
{
var section:TextFormat = myInputField.getTextFormat(sbi,sei);
if (section.bold == false)
{
myInputField.setTextFormat(formatBold, sbi, sei);
}
else
{
myInputField.setTextFormat(formatDefBold, sbi, sei);
}
stage.focus = this[selectedTextField]; // highlight the selected text again.
}
}
问题:
当我旋转 textInput 时,文本消失了。如果我嵌入字体并选择另一种抗锯齿方法,如“动画抗锯齿”,旋转后的 textInput 可以很好地显示文本,但 makeBold 函数不起作用。
我试过不同的字体。 Sans,Arial,我嵌入了它的所有样式(粗体、斜体、粗体斜体)。什么都没有!
我尝试将textInput 放在movieClip 中,然后旋转movieClip。不工作。
我也尝试过为textInput 设置embedFonts 参数,不确定是否正确
myInputField.embedFonts = true;
这一次即使textField 没有旋转,文本也会消失。
我真的被卡住了,想不出任何其他方法来使粗体功能与旋转的textInput 一起使用。
【问题讨论】:
标签: actionscript-3 rotation textinput