Hi,
What I want to do is I want a red box to appear around some text in my s:TextArea, which is editable.
Well, I can add a red box by putting the following after my text area.
<s:Graphic>
<s:Rect x="20" y="110" width="20" height="20" >
<s:stroke>
<s:SolidColorStroke color="0xFF8888"/>
</s:stroke>
</s:Rect>
</s:Graphic>
However the user will edit the text, and the text position will change. Also the user will scroll the text area up and down.
So the location of the box should move to still be located around the text.
How can I track the position of the text? Is this a good idea? to track the position of the text and to keep moving the box to keep it on top of the text?
Thanks, Philip
Philip,
How about something like this?
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
<s:TextArea id="txtArea"
horizontalCenter="0" verticalCenter="0">
<s:content>
<s:p>The quick brown fox jumps <s:span backgroundColor="0xFF0000" backgroundAlpha="0.8">over</s:span> the lazy dog.</s:p>
</s:content>
</s:TextArea>
</s:Application>
Peter
Its an interesting idea, but I would really like to be able to overlay complex graphics over the text.
Hi Peter,
Would I be able to get the position of a <span id... tag within any of the text components in Gumbo.
Such as in?
s:RichEditableText
In this way, I could put a span around the text then get the X,Y cordinate of it, or the bounding box.
Another *hack* way I could do it is to color the text in the span a particular color, then convert this editor to a bitmap image and search the image for that color. Then I could find the X,Y location of the text.
Thanks, Philip
Philip,
I’m not sure, but the best place to ask would probably be on the Text Layout Format (TLF) forums at http://forums.adobe.com/community/opensource/tlf
I *think* they have some examples of adding custom shapes around text (similar to the underlines on a spell checker).
Sorry,
Peter
Ok thanks I post my question there.
Copyright © 2010 Adobe Systems Incorporated. All rights reserved.
Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy (updated 07-14-2009).