Skip to main content
August 13, 2009
Question

Flex component over text?

  • August 13, 2009
  • 1 reply
  • 1371 views

Hi,

I wrote a question in the other board and they suggested that I come here for a better answer.

http://forums.adobe.com/thread/474696?tstart=0

I'll describe my question more clearly here.

What I want to do is have some flex component hover over the top of the text at certain positions in the text, as I want to provide some rich editing for certain types of data - such as I want to provide a excel type grid for editing data inline within the document. When the user edits the grid, the text in the document is updated.

Alternatively, if the component can be inline in the document that is ok as well.

So what I managed to achive by myself is that I can position a flex button over the text, what I did was to convert the textarea to a bitmap image where I had changed some small bit of text to red before i did the bitmap, then i searched the image for the red color then position my button over the red text.

This kind of works, but very hacky and not efficient. Im searching the bitmap for red text.

In general, I want to be able to position components in the text area. Now I also saw some posts on this in this newsgroup but dont really solve my problem.

I read in this message it says "If you really need interactivity, I think you'[ll need to make the interactive component a sibling of the text component -- i.e., so that both of them are regular Flex components inside a regular Flex container -- but position it on top of the text at the appropriate location. You might be able to use a non-interactive InlineGraphicElement inside the text as a placeholder, determine where it has been laid out, and then position the interactive sibling on top of it.".

http://forums.adobe.com/thread/474062

That sounds simular to what I am doing but it uses InlineGraphicElement, how would I put this element in the text and how would I get its actual position on the screen? If I can do this, then its a great step forward to solving this problem.

Thanks in advance, Philip

This topic has been closed for replies.

1 reply

Participating Frequently
August 13, 2009

> InlineGraphicElement ... how would I put this element in the text

If you are using markup, it corresponds to the <img> tag.

> how would I get its actual position on the screen?

An InlineGraphicElement has a 'displayObject' property. I think you could use that DisplayObject's getBounds() method to find out where it is, in any coordinate system. But I'm not sure whether this will properly take scrolling into account. Maybe Rich can suggest a better way.

Gordon Smith

Adobe Flex SDK Team