Skip to main content
March 24, 2009
Question

Error #1009 in /computeSelectionIndexInContainer()

  • March 24, 2009
  • 8 replies
  • 3987 views
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashx.textLayout.edit::SelectionManager$/computeSelectionIndexInContainer()
at flashx.textLayout.edit::SelectionManager$/ http://ns.adobe.com/textLayout/internal/2008::computeSelectionIndex()
at flashx.textLayout.edit::SelectionManager/selectionPoint()
at flashx.textLayout.edit::SelectionManager/setNewSelectionPoint()
at flashx.textLayout.edit::SelectionManager/mouseDownHandler()
at flashx.textLayout.container::ContainerControllerBase/processMouseDownEvent()
at flashx.textLayout.container::ContainerControllerBase/ http://ns.adobe.com/textLayout/internal/2008::mouseDownHandler()

Sometimes when i just drag mouse on tf container, it throws this exception. Quite many times.
This topic has been closed for replies.

8 replies

Khaye2728
Participant
December 15, 2009

I am not sure if I can be a help but you can try this anyway.... Thanks!

Issue


Issue FLEXENT-742 has been logged against AdobeFlex Builder Professional when used with the Automated Testing module and the AdvancedDataGrid. Specifically, when using Quick Test Pro to record a "select" action on a cell with a RendererProvider as the content holder, the following ActionScript error is displayed:

An ActionScript error has occurred:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

Solution


The following procedure may be used to work around this error:

  1. Download the following ActionScript file:

    http://bugs.adobe.com/jira/secure/attachment/17407/AdvancedListBaseContentHolderAutomationImpl.as
    <!--[if !supportLists]-->
  2. Add this file into the src folder of the Flex Builder project and include this delegate using the -includes option as follows:

    -locale en_US -includes AdvancedListBaseContentHolderAutomationImpl
    -include-libraries
    "C:\Work\flex\sdk_3.0.0.256\frameworks\libs\automation.swc"
    "C:\Work\flex\sdk_3.0.0.256\frameworks\libs\automation_dmv.swc"
    "C:\Work\flex\sdk_3.0.0.256\frameworks\libs\automation_agent.swc"
    "C:\Work\flex\sdk_3.0.0.256\frameworks\libs\qtp.swc
Inspiring
December 15, 2009

Removed original post...

I was setting whiteSpaceCollapse on the TextFlow, and although I was calling updateAllControllers(), this was still throwing the error in computeSelectionIndexInContainer() (using Flex SDK 3.5 with TLF SWC 502 from Flex SDK 4 b2).

textLine is null for textFlow.flowComposer.getLineAt(lineIndex); when lineIndex is 0. I'm exclusively editing through the editManager, in fact in this case I can reproduce simply by typing some text and trying to press backspace.

Anyway, for now I have moved this code elsewhere and all is fine, thanks for the tips!

Adobe Employee
December 15, 2009

Can you make an example that demonstrates the bug and shows what you are doing with whiteSpaceCollapse?  That property is only applied at import time.

I can get the crash to happen like this:

        public function EmptyFlow()
        {
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
           
            var textFlow:TextFlow = new TextFlow();
            textFlow.interactionManager = new EditManager();
            var s:Sprite = new Sprite();
            s.x = s.y = 25;
            addChild(s);
            textFlow.flowComposer.addController(new ContainerController(s,500,300));
            textFlow.flowComposer.updateAllControllers();
            textFlow.whiteSpaceCollapse = WhiteSpaceCollapse.COLLAPSE;
        }

And then click on the stage.

But this is a be a coding error - after any model change the client must call updateAllControllers

Thanks,

Richard

Inspiring
December 16, 2009

Yes it was definitely a coder error, I was calling it after the import time, twice in fact. Thanks for the clarification.

Participant
May 6, 2009

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at flashx.textLayout.edit::SelectionManager$/computeSelectionIndexInContainer()
    at flashx.textLayout.edit::SelectionManager$/http://ns.adobe.com/textLayout/internal/2008::computeSelectionIndex()
    at flashx.textLayout.edit::SelectionManager/selectionPoint()
    at flashx.textLayout.edit::SelectionManager/setNewSelectionPoint()
    at flashx.textLayout.edit::SelectionManager/mouseDownHandler()
    at flashx.textLayout.container::ContainerController/mouseDownHandler()
    at flashx.textLayout.container::ContainerController/http://ns.adobe.com/textLayout/internal/2008::requiredMouseDownHandler()

I run into the same Error using Flex 3.3.0, with the latest build of TLF (422).

It occurs when I have mouse interactions with Flex-Components outside the TLF-DisplayContainer. When I now click back into the TLF-DisplayContainer (or try to select text inside) the error is thrown.

I wonder if the reason ist that the cursor inside the displayContainer is still visilbe (active?) although the mouse interacted somewhere else.

Adobe Employee
May 6, 2009

Thanks for the report - I haven't seen that problem but will investigate.  I was looking at that code last night for a separate issue.

Generally that routine is called when a hit's target is the Container but not on a particular TextLine or the Container has mouseChildren set to false.  Its intended to calculate where the hit is and is independent of current selection and other mouse interactions.

Richard

Adobe Employee
May 6, 2009

Hi,

I found a likely culprit and will get this fixed at some point.

Thanks again for the report.

Richard

Adobe Employee
April 1, 2009
Easiest way to see it programmatically is check for flashx.textLayout.BuildInfo.kBuildNumber. I think it also gets referenced in the revision notes in the Flex Gumbo Subversion repository. It's a good idea to check the Subversion revision notes, since a lot of version-to-version change notes are posted there, and there will be more in future.
Participating Frequently
April 1, 2009
Perhaps a silly question but - how can I tell the build number of TLF (as opposed to the revision of Gumbo) ?
Adobe Employee
March 26, 2009
I fixed several bugs in computeSelectionIndexInContainer. The fixes are in builds 399 and later.

Regards,
Richard
March 25, 2009
i use Flex , gumbo latest build.
what i did is : import textflow then modify its content programmatically , call updateContainers, mess around with editManager (insert/delete text) then try to select portion of text. Sometimes this exception just bursts out.

i will try to catch it again and report in details.
brian_thomas2
Adobe Employee
Adobe Employee
March 24, 2009
Can you provide more specific steps to reproduce this? Maybe a code snippet that allows us to recreate the error?

How are you using TLF? Flash CS4? Flex? Did you obtain TLF from the labs site, or from the Gumbo repository?