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 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 says that img tag accepts a library symbol, but I couldn't find any example where this is true.
Any help would be appreciated.
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.
So, if your movieClip is exported as 'myImage_mc", your html will be:
<img src="myImage_mc" width="100" height ="100"/>
Update.
To clarify, here's my symbol in the library:
Here's my actionscript:
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):
Note: this doesn't seem to work if the img is the only tag in the field. You have to add some text, even if it is not visible. An empty P won't work, so either of these will fail:
textField.htmlText = "<img src='HKP'/>";
textField.htmlText = "<p></p><img src='HKP'/>";
... but this works:
textField.htmlText = "<p> </p><img src='HKP'/>";
... which is pretty much a classic Adobe gotcha ;)