5 Replies Latest reply: Nov 26, 2013 4:12 AM by Gaius Coffey RSS

    [bug] TLF, SelectionManager and popup

    Jan Klosinski Community Member

      hi,

       

      it seems that Squiggly doesn't work well with TLF SelectionManager.

       

      Steps to reproducs:

      1. open popup

      2. close popup (don't type anything in the text input)

      3. open popup

       

      You should see the following error:

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
           at flashx.textLayout.edit::SelectionManager$/computeSelectionIndexInContainer()[C:\Vellum\branches\v1\1.1\dev\output\openSource\textLayout\src\flashx\textLayout\edit\SelectionManager.as:827]
           at flashx.textLayout.edit::SelectionManager$/http://ns.adobe.com/textLayout/internal/2008::computeSelectionIndex()[C:\Vellum\branches\v1\1.1\dev\output\openSource\textLayout\src\flashx\textLayout\edit\SelectionManager.as:1111]
           at com.adobe.linguistics.spelling.ui::SparkHighlighter/getValidFirstWordIndex()[E:\glo_lib\esg\users\ravi\squiggly\0.3\AdobeSpellingUI\src\com\adobe\linguistics\spelling\ui\SparkHighlighter.as:212]
           at com.adobe.linguistics.spelling.ui::SparkHighlighter/doSpelling()[E:\glo_lib\esg\users\ravi\squiggly\0.3\AdobeSpellingUI\src\com\adobe\linguistics\spelling\ui\SparkHighlighter.as:69]
           at com.adobe.linguistics.spelling.ui::SparkHighlighter/handleFocusIn()[E:\glo_lib\esg\users\ravi\squiggly\0.3\AdobeSpellingUI\src\com\adobe\linguistics\spelling\ui\SparkHighlighter.as:94]
           at flash.display::Stage/set focus()
           at mx.core::UIComponent/setFocus()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:9544]
           at spark.components::RichEditableText/setFocus()[E:\dev\4.x\frameworks\projects\spark\src\spark\components\RichEditableText.as:2712]
           at spark.components.supportClasses::SkinnableTextBase/setFocus()[E:\dev\4.x\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableTextBase.as:1116]
           at mx.managers::FocusManager/setFocus()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\FocusManager.as:597]
           at CustomPopup/reset()[C:\Documents and Settings\klosinja\Local Developer\workspaces\flashbuilder\SquigglyBugs\src\CustomPopup.mxml:22]
           at PopupBug/openPopup()[C:\Documents and Settings\klosinja\Local Developer\workspaces\flashbuilder\SquigglyBugs\src\PopupBug.mxml:17]
           at PopupBug/___PopupBug_Button1_click()[C:\Documents and Settings\klosinja\Local Developer\workspaces\flashbuilder\SquigglyBugs\src\PopupBug.mxml:26]
           at flash.events::EventDispatcher/dispatchEventFunction()
           at flash.events::EventDispatcher/dispatchEvent()
           at mx.core::UIComponent/dispatchEvent()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:12528]
           at spark.components.supportClasses::ButtonBase/keyUpHandler()[E:\dev\4.x\frameworks\projects\spark\src\spark\components\supportClasses\ButtonBase.as:987]
      
      

       

      application

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
          xmlns:s="library://ns.adobe.com/flex/spark" 
          xmlns:mx="library://ns.adobe.com/flex/mx" 
          xmlns:local="*"
          minWidth="955" minHeight="600" 
          >
          
          <fx:Script>
              <![CDATA[
                  import mx.core.IFlexDisplayObject;
                  import mx.managers.PopUpManager;
                  
                  public function openPopup():void
                  {
                      PopUpManager.addPopUp(popup, this);
                      popup.reset()
                  }
              ]]>
          </fx:Script>
          
          <fx:Declarations>
              <local:CustomPopup id="popup" />
          </fx:Declarations>
          
          <s:Button label="open popup" click="openPopup()" />    
          
      </s:Application>
      
      

       

      CustomPopup.mxml

      <?xml version="1.0" encoding="utf-8"?>
      <s:Panel 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="300"
          creationComplete="SpellUI.enableSpelling(txt, 'en_US')"
          >
          
          <fx:Script>
              <![CDATA[
                  import mx.managers.PopUpManager;
              ]]>
          </fx:Script>
          
          <fx:Script>
              <![CDATA[
                  import com.adobe.linguistics.spelling.SpellUI;
                  
                  public function reset():void
                  {
                      txt.text = "";
                      focusManager.setFocus(txt);
                  }
              ]]>
          </fx:Script>
          
          <s:layout>
              <s:VerticalLayout/>
          </s:layout>
          
          <s:TextInput id="txt" />
          
          <s:Button label="close" click="PopUpManager.removePopUp(this)" />
          
      </s:Panel>
      
      

       

      Any suggestions?

       

      thanks,

      Jan