|
-
Senior Member
Thank you, v5000.
That's definitely an improvement on what I'm doing...and it seems like that would actually do a better job at preventing the cut from taking place in the dead center of a tag itself...
but it still leaves me unable to determine the prior encapsulating tag so I can replicate it at the start of the second text field. Say I made the chop in the middle of the bold and italic tags, and I want the second field to start with those... if I knew the index of the cut point in the .htmlText string, I could just search back and figure out what tags were open and replicate them. But knowing the breakIndex in your example doesn't tell me where I am in the htmlText...i.e. where I need to search back from to find any encapsulating tags. The method I'm using right now to determine this, with mixed success is tantamount to:
Code:
var htmlBreakPoint:int = -1;
var c:int = 10;
while (htmlBreakPoint==-1) {
htmlBreakPoint = htmlText.getIndex(field2.text.substr(0,c));
c--;
}
But it's pretty bad; the more tags there are, the shorter plaintext strings it has to look for, and therefore the more false positives, especially if those plaintext strings are repetitious ("is", "are", etc.)...
Somewhere deep inside of TextField, I'm convinced, there's a counter that tells it how much .htmlText has been parsed away up to a given point; that's what I need to get at...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|