Skip to main content
Participant
August 18, 2011
Question

Getting a runtime error in TextContainerManager.as

  • August 18, 2011
  • 1 reply
  • 536 views

Using Adoeb AIR 2.7 & Flex SDK 4.5.1.21328 & TLF 2.1

The error is thrown on line 2425: (TextContainerManager.as)

parent value is null

tlf_internal function removeInlineGraphicElement(parent:DisplayObjectContainer, inlineGraphicElement:DisplayObject):void           {                if (inlineGraphicElement.parent == parent)                     parent.removeChild(inlineGraphicElement);           }

Here is the error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.      at flashx.textLayout.container::TextContainerManager/http://ns.adobe.com/textLayout/internal/2008::removeInlineGraphicElement()

Reproduce step.

1. AddImage button click. And select any image.

2. Add two or three images.

3. After moving the cursor to the end.

4. 5-6 times press enter.

5. The scroll bar is displayed, press Enter several times an error occurs.

Here is the full source code:

<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"                             xmlns:s="library://ns.adobe.com/flex/spark"                             xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="500">      <fx:Declarations>           <!-- Place non-visual elements (e.g., services, value objects) here -->      </fx:Declarations>      <s:layout>           <s:VerticalLayout gap="0" horizontalAlign="center"/>      </s:layout>      <fx:Script>           <![CDATA[                import flashx.textLayout.edit.EditManager;                               private function addImage(event:MouseEvent):void                {                     var em:EditManager = editor.textFlow.interactionManager as EditManager;                     em.selectRange(editor.selectionAnchorPosition, editor.selectionActivePosition);                     editor.setFocus();                                         var file:File = new File();                     var imagesFilter:FileFilter = new FileFilter('Images', '*.jpg;*.gif;*.png');                     file.addEventListener(Event.SELECT, onSelectedImage);                     file.browseForOpen('Select Image', [imagesFilter]);                }                               private function onSelectedImage(event:Event):void                {                     var file:File = event.target as File;                     var em:EditManager = editor.textFlow.interactionManager as EditManager;                     em.selectRange(editor.selectionAnchorPosition, editor.selectionActivePosition);                     editor.setFocus();                                         em.selectRange(editor.selectionAnchorPosition, editor.selectionActivePosition);                     em.insertText('\n');                     em.insertInlineGraphic(file.nativePath,200,200);                     editor.textFlow.flowComposer.updateAllControllers();                     editor.setFocus();                }                     ]]>      </fx:Script>      <s:TextArea id="editor" width="100%" height="100%" lineHeight="102%" />      <s:Button id="addImgBtn" label="AddImage" click="addImage(event)" /> </s:WindowedApplication>

Please check.

Thanks.

This topic has been closed for replies.

1 reply

Adobe Employee
August 22, 2011

You won't get the runtime error with TLF 3.0.

2.1 has only few critical bug fixes, comparing to 2.0. Performance enhancements and the bug fixes after 2.1 are put into 3.0.