AS2 css字体消失

发布于 2024-08-23 22:37:42 字数 257 浏览 12 评论 0原文

我继承了一个用 AS2 编写的项目。它以编程方式创建文本字段并填充它们。它指的是样式表,其中样式表为 font-style:italic;

一切都以斜体显示就好。但我被要求将其更改为正常。当我将其更改为 font-style:normal;在样式表中,文本消失。并且在代码中,它引用 htmlText 作为文本字段的属性。

有谁知道这可能是由于什么原因造成的?起初我想也许嵌入字体,但如果应用了样式并且它是 htmlText 那不是没有必要吗?

谢谢。

I've inherited a project written in AS2. It programatically creates textfields and populates them. It refers to a stylesheet, and in that stylesheet is font-style:italic;

Everything shows in italic just fine. But I've been asked to change it to normal. WHen I change it to font-style:normal; in the stylesheet, the text disappears. And in the code, it refers to htmlText as the property of the textfield.

Anyone know what this could be due to? At first I was thinking maybe embed the font, but if a style is being applied and it's htmlText wouldn't that be unnecessary?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尤怨 2024-08-30 22:37:42

我试图重现你的问题......

// populate some text fields...
var myList:Array = new Array("<p><b>hello</b> world</p>", "<p>goodbye <i>cruel</i> world</p>");
var myStyle:TextField.StyleSheet = new TextField.StyleSheet();
myStyle.parseCSS("p {font-style:italic;}");
var myField:TextField;
for (var i:Number = 0; i<myList.length; i++) {
    myField = this.createTextField("myText"+i, this.getNextHighestDepth(), 100, 50+i*50, 300, 40);
    myField.html = true;
    myField.styleSheet = myStyle;
    myField.htmlText = myList[i];
}

//now click to switch from italic to normal
this.onMouseUp = function() {
    if (myStyle.getStyle("p")['fontStyle'] == "italic") {
        myStyle.parseCSS("p {font-style:normal;}");// all normal (except 'cruel')
    } else {
        myStyle.parseCSS("p {font-style:italic;}");// all italic
    }
}

但它似乎对我来说工作得很好。您对 TextFields 做了什么额外的事情吗,比如嵌入字体或其他什么?

尝试嵌入时,快速谷歌显示许多听起来相似的问题 html 文本字段的字体。

希望这有帮助。

I tried to reproduce your problem...

// populate some text fields...
var myList:Array = new Array("<p><b>hello</b> world</p>", "<p>goodbye <i>cruel</i> world</p>");
var myStyle:TextField.StyleSheet = new TextField.StyleSheet();
myStyle.parseCSS("p {font-style:italic;}");
var myField:TextField;
for (var i:Number = 0; i<myList.length; i++) {
    myField = this.createTextField("myText"+i, this.getNextHighestDepth(), 100, 50+i*50, 300, 40);
    myField.html = true;
    myField.styleSheet = myStyle;
    myField.htmlText = myList[i];
}

//now click to switch from italic to normal
this.onMouseUp = function() {
    if (myStyle.getStyle("p")['fontStyle'] == "italic") {
        myStyle.parseCSS("p {font-style:normal;}");// all normal (except 'cruel')
    } else {
        myStyle.parseCSS("p {font-style:italic;}");// all italic
    }
}

... but it seems to work fine for me. Is there anything extra that you're doing with your TextFields, like embedding fonts or anything?

A quick google shows lots of similar-sounding issues when trying to embed fonts for html textFields.

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文