> Hi list, any tips on how to create a text highlighter? The > perfect solution will be that I use the text cursor inside > the textfield. Now, I was thinking of using drawing API on > the invisible mc below the textfiled and when I would click > in the textfield I would start drawing a rectangle on that mc. > But, the problem is that with the text cursor you can click > anywhere between the lines and it will select the closest > line. So I can't get the exact y coordinate where to start > drawing the rectangle. > > Also, I don't think I can use background-color css property > as it's not supported according to Flash documentation.
It's a very tricky problem - not only are there the problems you mention, but also if they're selecting multiple lines you need to draw three rectangles rather than one - the shorter top and bottom part-lines and the full lines in the middle. I've done it in the past (although in the end I didn't use it) by creating a function that homes in on the exact coordinates of the insertion point by adding text into a hidden field and using textWidth / textHeight (the tricky part is finding the start of the current line, the rest is fairly easy, although I'm not sure how you'd do centre-aligned text). It sounds hideous, but actually Flash is pretty fast at that kind of thing and it worked fine in real-time for reasonably short text. If your text is single-line, obviously it's much easier. Best Danny _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

