Hi

I think I've done this in two different ways in the past (for different
situations)

I'm at work and don't have any code here,
but, from memory, the main concepts were

--------------------------------------------------------
1: tag / stack based (was filtering tags at the same time)

go through the htmltext,
push opening tags onto a stack (ignor <br> and other non-spanning tags)
pop when closing tag is encountered(check that it's the same tag if you
like - if not, do some workaround ? :S )
count actual displayed characters as you go

when you get to the text you want,
use the stack contents (it should contain all the applicable tags)

continue on and copy the html text (keep pushing/popping)
when you've got the required character count,
pop down through the stack closing each tag (these are the one's still open)

--------------------------------------------------------
2: text format based

make a html textfield (source)
stick your text in it
look at the mytextFld.text string to find the required substring indices
make another html textfield (destination)
put your unformatted substring in it

got through the new field copying each characters the textformat from the
source texfield (using your substring start index as an offset) and applying
it to the source

the sourceFld.htmltext should now have what you're after

--------------------------------------------------------


hope this give you more ideas (unless you've got too many options already :)

cheers,
glenn




----- Original Message ----- 
From: "Jayson K Hanes" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Wednesday, January 18, 2006 10:21 AM
Subject: RE: [Flashcoders] efficient htmltext.reduce() function?
orsimilaridea?


Hmmm... so then... I would have to re-assemble the htmltext each time...


That's possibly not a bad idea... I'll try it!.. doesn't solve the
original goal.. but it might work well enough!

Thanks Paul!

-Jayson

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Paul BH
> Sent: Tuesday, January 17, 2006 6:18 PM
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] efficient htmltext.reduce() function?
> orsimilaridea?
>
> so, what you are trying to do is store information, and be able to
> display the information as html text, *and* have a maximum size of the
> stored information so that the html text doesnt get too unweildly...
>
> so, the trouble you are having is that using html is a tricky way of
> storing your information, when you want to manipulate it?
>
> so, how about you have a class that accepts html text as an input,
> each time you input it, it adds to a stack of some sort, and then the
> class has a toHTMLString(maxSize) function on it, used to generate the
> outputted html
>
> I guess what I am suggesting is that it might be easier to work with
> objects that can be combined to output html text than trying to work
> directly on the html...
>
> did that muddy the waters enough ;) ?
>
> On 1/17/06, Jayson K Hanes <[EMAIL PROTECTED]> wrote:
> > Yes you have the issue understood! :)
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to