PDA

View Full Version : htmlText hell



Didi32
June 29th, 2009, 01:54 PM
Hi, I'm using htmlText property for some text, what I'm doing is 3 images aligned to the left, one under the other, and allow each line of text to be next to one image.

Here is the html used:
<img src="image1.png" width="50px" height="50px"/><p>First line to be next to image 1</p>
<img src="image2.png" width="50px" height="50px"/><p>Second line to be next to image 2</p>
<img src="image3.png" width="50px" height="50px"/><p>Third line to be next to image 3</p>

I expect each line to appear right next to the image, but instead of that, when I use the string with textField.htmlText = myString;

I get all the sentences next to my image1.png, not each next to their own image. I've tried anything, adding style and putting a height to the p tag, no effect. I'm running out of ideas. This seems rather elementary to achieve, however, it seems very complicate with AS3.

Thanks for your help,

.ral:cr
June 29th, 2009, 02:00 PM
it's strange indeed, but html in flash is not very advanced. my suggestion is to rethink it, or try to add <br> till you position the text where you want.

Didi32
June 29th, 2009, 02:04 PM
I've tried the br tags, but it's very unpredictible and doesn't align well.

I was thinking of using <textformat tabstops='[100, 200]'>
</textformat>

to create two columns, and three rows, the only problem is that I don't know how to make the separation between the rows in my string.

I found the following in a forum:


var rowHeaders = "<b>Name\t</b><b>Age\t</b><b>Department";
var row_1 = "Tim\t31\tIMD";
var row_2 = "Edwin\t42\tQA";
table_txt.htmlText = "<textformat tabstops='[100, 200]'>";
table_txt.htmlText += rowHeaders;
table_txt.htmlText += row_1;
table_txt.htmlText += row_2 ;
table_txt.htmlText += "</textformat>";

each row is added with += it seems, but what happens if I only have a single string pulled from XML? How could I separate each row?


Thanks,

Didi32
June 29th, 2009, 02:20 PM
I just tried to make rows with images, and they do not align with the other cells either. So I'm stuck.