Skip to main content
rstawarz
Participant
March 15, 2009
Answered

Select across TextFlow objects

  • March 15, 2009
  • 3 replies
  • 1245 views
I'm curious to know if there is a way to link multiple TextFlow objects to the same SelectionManager? In other words if I have two TextFlow objects on the same display, how would I be able to select across both of them? Is there a way to do this?

Thanks,
-Ryan
This topic has been closed for replies.
Correct answer robin_briggs
Each SelectionManager has just one TextFlow. But a TextFlow may have multiple containers, and this will allow selecting across the two containers. See the LinkedContainers.as for an example.

3 replies

Adobe Employee
March 19, 2009
The work is not yet scheduled.

I'm not sure what the best way to do it would be. Simplest is likely to have an element in the flow that signals a break, most flexible would be to have an API that allows the client to make some choices dynamically. Which would you prefer?

For now, I think you could get different behavior by overriding the FlowComposer, but that would not be easy. I'm not even certain that you would have all the pieces you need to do it successfully, though I won't rule it out.
rstawarz
rstawarzAuthor
Participant
March 26, 2009
As for the api, I think tying it to a flow element (maybe just the div) would make a lot of sense. I think doing it in one of two ways - maybe both.

First it would probably just be easiest to have a 'container-break' property on the flow element which would demarcate to the FlowComposer that this element should no longer be placed in the current container. This could make it possible to do both programmatically by setting the property on the instance, as well as via the XML representation. This makes some assumptions that the parsing and adding flow elements are done linearly and thus laying them into containers happen the same way. I think this is totally reasonable and should be fairly easy to implement.

Second if we wanted to be more specific, their could be a 'container-id' that would be the id of a specific container that the flow element should be put in. While this may seem more useful, I think it would probably be much more complex to implement and in most cases wouldn't really be needed.

Thanks,
-Ryan
Adobe Employee
March 17, 2009
There is no way to specify which FlowElements go in which container. We have had that as a request, and I think it would be very helpful, we just haven't gotten to it yet. In the meantime, you will have to add the text into the container, then compose and get the contentHeight, and then resize the container to that. I added something recently that allows you to set the compositionWidth or compostitionHeight of the container to NaN, and then its as if the container were infinitely large in that dimension. I don't know whether that is in the current Flex Gumbo drop or not. If not, you can just set the height to a large number and then scale it down. If you prefer, you can call compose() instead of updateAllContainers and nothing will show on screen. Then, when you've made all the adjustments, you can call updateAllContainers().

Hope this helps,

- robin
rstawarz
rstawarzAuthor
Participant
March 19, 2009
So it's nice to know that dictating which element goes in which container has been requested. Is that something that is planned to be done or just on the 'nice to have list'?

Is that something that would be controlled by the FlowComposer? In other words is there something I could override/implement in the framework that would accomplish my goal?

At a basic level what would work for me is to be able to invoke a method on the TextFlow/Composer that would tell the composer that it should no longer continue adding elements to the current container. Of course my assumption would be that the composer allocates elements linearly in order to the added/known containers.

Thanks,
-Ryan
robin_briggsCorrect answer
Adobe Employee
March 16, 2009
Each SelectionManager has just one TextFlow. But a TextFlow may have multiple containers, and this will allow selecting across the two containers. See the LinkedContainers.as for an example.
rstawarz
rstawarzAuthor
Participant
March 17, 2009
Thanks Robin! I think this is what I was looking for. This leads me to another question though - is there a specific way to state what FlowElements goes into each container, or would I have to do all the measurements up front before executing compose? For example, lets say I want to add 2 different div's with additional content in each into two different containers (i.e sprites). Is there a way to determine how high/wide each div is easily so I can set the containers to the appropriate sizes?