Skip to main content
Inspiring
April 6, 2010
Answered

Linked Containers problem

  • April 6, 2010
  • 1 reply
  • 420 views

Hi,

I'm trying to have text flowing in multiple containers. Those container are created in ActionsScript. When a new RichEditableText is created, I'm doing this:

public function addTextContainerl(newText:RichEditableText):void
{
            var newPageController:ContainerController = new ContainerController( newText );
            newPageController.setCompositionSize( newText.width, newText.height);
            var firstControllerFormat:TextLayoutFormat = new TextLayoutFormat();
            firstControllerFormat.paddingTop = 4;
            firstControllerFormat.paddingRight = 4;
            firstControllerFormat.paddingBottom = 4;
            firstControllerFormat.paddingLeft = 4;
            newPageController.format = firstControllerFormat;
            textFlow.flowComposer.addController(newPageController);
           
            //  Draw the text, and make it editable
            textFlow.flowComposer.updateAllControllers();
            textFlow.interactionManager = new EditManager();
}

Before that, when the application is initialized, I do:

textFlow  = TextConverter.importToFlow(markup, TextConverter.TEXT_LAYOUT_FORMAT);
textFlow.flowComposer = new StandardFlowComposer();

textFlow is a private var, and markup is a string with some formatted text.

It works ok (the text renders and flows), but if I click on one of the RichEditableText one of two things happen:

1. The text disapears.

2. I got this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at flashx.textLayout.edit::SelectionManager$/computeSelectionIndexInContainer()

Any ideas?

This topic has been closed for replies.
Correct answer rdermer

RichEditableText doesn't support linked containers and you probably can't hack them in.  I'd suggest using TLF Apis directly and create ContainerControllers for Sprites that you display as rawChildren.

Hope that helps,

Richard

1 reply

rdermerCorrect answer
Adobe Employee
April 7, 2010

RichEditableText doesn't support linked containers and you probably can't hack them in.  I'd suggest using TLF Apis directly and create ContainerControllers for Sprites that you display as rawChildren.

Hope that helps,

Richard