This content has been marked as final. Show 6 replies
What kind of undesired output are you getting when you use HTML tags? I would assume that your array would contain entries such as:
helpText  = "<font"
helpText = "color='red'"
helpText = ">"
It's possible that you won't be able to split your array using String.split(" "). You'll probably have to create a function to manually split your string, I've posted an example below. It's just a starting point for you to fiddle around with, It may not work depending on how your XML is formed, etc... but at least you have an idea.
I am sorry for not being able to convey my problem.... actually problem is not that code is not recognizing the tags but the problem is.... let me explain, suppose there is a tag <b> and </b> in xml..... code split the text so it split <b> and </b> too and stored it in an array.... then it adds the text i.e. This is a <b> sample </b> text..... til the textheight of the textfield is less than the ._height of hte textfield and finally i have a string that fits in the textfield perfectly and when the parted text is assigned to the textfield it recognize the tag and make that bunch of words or sentence bold and that creates the problem.... i hope that this time it is more clearer....
So if I understand properly, you don't want the textfield to render the HTML? As in the example you just posted, you don't want the word sample to be bold? Or is it that the bold text comes along and messes up the width of your string that fits perfectly?
If you don't want the textfield to render the html tags, then simply add those conditions to your TextFormat object.
var my_fmt:TextFormat = new TextFormat();
my_fmt.bold = false;
my_fmt.italic = false;
my_fmt.underline = false;
Then your textfield will not show text effects or the html tags.
If the problem is that the width is messed up because of the bold text, send me the dimensions of your textfield so I can test it properly.
Exactly, the width messes up because of bold text, or because different font type..... regarding dimensions of the textfield
width = 525;
height = 185;
Thanks again FlashTastic..... problem could be solved in another way also....
Actually why I am doing this is just because of the accessibility for screen reader.... as soon as focus get to the textfield, screen reader reads all the text in the textfield..... mind it all the text (visible and invisible text both) and then it conflicts the more button concept...... so if you could suggest a better approach to solve this problem that would be greatly appreciated
As far as I know, there's no way that you can target the width of the individual characters in the textfield. It looks like you only have two options.
1. Modify your code to restrict text to 1/5 less than the height of the textfield, to account for bold text being there. You could create a function that runs only if it detects bold text in the string it's putting into the textField.
2. Remove bold/italic formatting, and let your client know it's a limitation.
I'm sorry I don't have another solution for you, I wish I did.
I guess you are right FlashTastic
Thank you very much for your valuable comments.