Skip to main content
Participating Frequently
July 29, 2010
Answered

Would like a TextInput that extends FlowElement

  • July 29, 2010
  • 1 reply
  • 1913 views

I am writing a courseware application in Flex and find the Text Layout Framework very helpful, except that I have many cases where input fields must be within the flow, such as the following:

First there might be a question _________________ and ______________,

___________, then there might be another question __________________.

The input field does not need to be a RichTextEditor, it just needs to be able to move in the flow of the text so that format is maintained if a user increases the size of the text. 

I have seen statements in this forum that that the TLF was not designed to be extensible, making this a difficult task.  The only other solution that I can see is to put the text into RichText objects and the input fields into TextInput objects, and write a Format Controller that positions these on lines taking into account the ending position of each, and performing line breaks as needed.  Does anyone have a better idea?  The problem seems a little strange given the ease of doing this in HTML.

Gary

This topic has been closed for replies.
Correct answer robin_briggs

There's a blog entry I just found on this topic -- I haven't read through it, but you may want to check it out:

http://platustalksflex.blogspot.com/2010/07/position-uicomponents-inside-textflow.html

There's a related forum thread.

- robin

1 reply

Adobe Employee
August 2, 2010

I've never tried to do this, but here's something that might be easier & work better. In Flex, you can set up the fill-in-the-blanks fields as spans that are bound and have an ID. I think in Flex you can set up to receive change events when the text is edited. Then you could delete the underscores. The text will flow evenly across the lines, and you can get the new values out by accessing the "text" property of the span. I think you may also need to set up an event listener to prevent changes to the text that you want to be static. There may be an easier way to do this using the Flex change event, but if not you can attach to the TextFlow for a FlowOperationEvent.FLOW_OPERATION_BEGIN. When there is an InsertTextOperation, check to see if its going into one of the static text areas, and if so, cancel it.

Sorry I don't know more about Flex -- you could try posting this same question on the Flex forum and see if you get better answers.


Thanks,

- robin

Participating Frequently
August 2, 2010

Thanks.  This sounds like it will work well.  I will report back after trying it.

robin_briggsCorrect answer
Adobe Employee
August 2, 2010

There's a blog entry I just found on this topic -- I haven't read through it, but you may want to check it out:

http://platustalksflex.blogspot.com/2010/07/position-uicomponents-inside-textflow.html

There's a related forum thread.

- robin