سؤال

I have a TextField. Here is a snippet:

this.textField = new TextField();
this.textField.defaultTextFormat = font.format;
this.textField.selectable = true;
this.textField.border = true;
this.textField.wordWrap = true;
this.textField.multiline = true;

And here is the method to add new line to the textField box:

this.textField.htmlText = 'some text <IMG SRC="http://gravitatestudio.com/wp-content/themes/gravitate/images/facebook.png">';

The issue is that an image is always placed UNDER text instead of the END OF THE TEXT.

Here is the trace(this.textField.htmlText) after html text has been added:

<P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="12" COLOR="#FFFFFF" LETTERSPACING="0" KERNING="0">some text <FONT SIZE="2"><IMG SRC="http://gravitatestudio.com/wp-content/themes/gravitate/images/facebook.png"> </FONT></FONT></P>

Also I need to add an image to any side of the text like a chat message using smiles (left, middle, right side of the text).

Any suggestions?

هل كانت مفيدة؟

المحلول

TextField html text is very limited and thats why Adobe released TLFTextFields which will give you much more control over the layout of elements in the field. I have personally used it and have made entire chats out of one textfield with images, links etc.

resource: adobe: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/text/TLFTextField.html

tutorial: http://flashsimulations.com/2010/09/10/handling-image-loading-in-tlf-textflow-and-textfield/

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top