在的htmlText&LT使用来自库元件; IMG>在ActionScript 3的标签元件、标签、LT、htmlText

2023-09-09 21:34:58 作者:穿着校服逛酒吧°

问题是这样的:我需要添加图像使用IMG标记文本字段,但是我不能从库中引用的符号在我的swf文件

Problem is this: I need to add image to textField using img tag, but I cannot reference a symbol from a library in my swf file.

txt.htmlText =  "test <img src='symbol1' height='10' width='10' align='right'/>";

AS实现这个符号连接是符号1,我试图嵌入这个SWF在我的课,但它总是给错误#2035 - 找不到网址

AS linkage for this symbol is symbol1 and i tried embedding this swf in my class but it always gives error #2035 - URL not found

的Adobe表示,IMG标记接受一个库符号,但我找不到任何例子,这是真的。

Adobe says that img tag accepts a library symbol, but I couldn't find any example where this is true.

任何帮助将是AP preciated。

Any help would be appreciated.

推荐答案

这是一段时间,因为我做了这一点,但我认为你需要创建一个影片剪辑与它里面的位图库,然后导出为ActionScript,然后加,由于在标记的联动。

It's a while since I did this but I think you need to create a movie clip in the library with the bitmap inside it, then export that for ActionScript, then add that as the linkage in the tag.

所以,如果你的影片剪辑导出为myImage_mc,你的HTML是:

So, if your movieClip is exported as 'myImage_mc", your html will be:

<img src="myImage_mc" width="100" height ="100"/>

更新。

要澄清一下,这是我在图书馆符号:

To clarify, here's my symbol in the library:

下面是我的动作:

import flash.text.TextField;

var textField:TextField = new TextField();
textField.htmlText = "<p>HKP</p><img src='HKP'/>";
textField.x = textField.y = 100;
stage.addChild(textField);

和这里的结果(这固然需要一些调整):

And here's the result (which admittedly needs a bit of tweaking):

注意:这似乎并没有工作,如果IMG是该领域唯一的标签。你必须添加一些文字,即使是不可见的。空普将无法正常工作,因此无论这些都将失败:

textField.htmlText = "<img src='HKP'/>";
textField.htmlText = "<p></p><img src='HKP'/>";

...但这个作品:

... but this works:

textField.htmlText = "<p> </p><img src='HKP'/>";

...这是pretty的很多经典的Adobe疑难杂症;)

... which is pretty much a classic Adobe gotcha ;)

 
精彩推荐
图片推荐