Skip to main content
Participant
August 4, 2010
Answered

TextContainerManager RTE

  • August 4, 2010
  • 2 replies
  • 1161 views

Hi,

I am using TLF in a spark list control item renderer.

The list data provider items create the TextFlow. However, when I try to create the textFlow only once I sometimes run into the error below:

Version:1.0 StartHTML:0000000149 EndHTML:0000001726 StartFragment:0000000199 EndFragment:0000001692 StartSelection:0000000199 EndSelection:0000001692 We always run into TypeError: Error #1009: Cannot access a property or method of a null object reference.
     at flashx.textLayout.container::TextContainerManager/set compositionWidth()
     at spark.components::RichEditableText/measureTextSize()
     at spark.components::RichEditableText/measure()
     at mx.core::UIComponent/measureSizes()
     at mx.core::UIComponent/validateSize()
     at mx.managers::LayoutManager/validateSize()
     at mx.managers::LayoutManager/doPhasedInstantiation()
     at mx.managers::LayoutManager/doPhasedInstantiationCallback()

Since only internal classes are in the stacktrace it is hard to debug.

When the textFlow is created every time the binding executes the code works fine.

Any idea?

In general: Can I re-use the same textFlow in different ui components?

Thanks,

Sönke

This topic has been closed for replies.
Correct answer robin_briggs

We got a good repro offlist (thanks!) and this is now fixed in out mainline (prerelease), on SourceForge: http://sourceforge.net/adobe/tlf/home/.

The workaround, for those who don't want to use the prerelease, is to call deep copy from the item renderer.

Hope this helps,

- robin

2 replies

Known Participant
January 17, 2011

I got a similar problem..

I have a RicheditableText include in select state using TLF in a spark list.

Instead of error. Some of my content will display in the wrong place after switching between list item couple times.

Item 6 will be display in item 5 slot. Item 1 will display in item 6 slot.

After some testing. I tried removing the transitions, it seems to fix the problem.

I also have to remove the Rotate 3d code to get rid of another crash.

<!--

<s:Transition fromState="selected">

<s:Sequence>

<s:Parallel duration="200">

<s:Resize target="{this}" easer="{sineOut}"/>

<s:Fade target="{itemDetails}" />

-->

<!--s:Rotate3D targets="{[itemDetails]}"

angleXFrom="0" angleXTo="90"

autoCenterTransform="true" /-->

<!--

</s:Parallel>

<s:RemoveAction target="{itemDetails}" />

</s:Sequence>

</s:Transition>

-->

<s:Transition toState="selected">

<s:Sequence>

<s:Parallel duration="1000">

<s:Resize target="{this}" easer="{sineIn}" duration="500"/>

<s:Fade target="{itemDetails}" />

<!--s:Rotate3D targets="{[itemDetails]}"

angleXFrom="90" angleXTo="0"

autoCenterTransform="true" /-->

</s:Parallel>

</s:Sequence>

</s:Transition>

Moral of the story, if you see something strange in flex, DISABLE TRANSITION

Adobe Employee
August 5, 2010

We're looking into this, but haven't yet figured out the path through the code that triggers this bug. If you could post a small example, that would be very helpful.

In general, no, you should clone the TextFlow to use it in multiple places (textFlow.deepCopy()).

Thanks!

- robin

flaircodeAuthor
Participant
August 5, 2010

Why isn't it possible to use the same textFlow instance multiple times?

It took me a while to find deepCopy. The first thing I would have expected would be a clone function though.

However, I still have the issue without re-using the same instance. The issue comes up with a spark list where each item renderer shows a textflow instance. There seem to be timing issues because at some point in time the controllers get removed from the TextLayoutManager which causes the NPE. I don't have a small test case yet. However, if there are any best practices or workarounds I am all ears.

Thanks,

Sönke

robin_briggsCorrect answer
Adobe Employee
August 10, 2010

We got a good repro offlist (thanks!) and this is now fixed in out mainline (prerelease), on SourceForge: http://sourceforge.net/adobe/tlf/home/.

The workaround, for those who don't want to use the prerelease, is to call deep copy from the item renderer.

Hope this helps,

- robin