Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-33791

TextLayoutFramework EditManager.ApplyFormat ignoring selection range

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: Apache Flex 4.10.0
    • Fix Version/s: Apache Flex 4.10.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      any 4.10 SDK

      Description

      when specifiying a text range for format to be applied, format is instead applied to entire paragraph

      <s:TextArea width="100%" height="100%" id="txt">
      <s:content>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit.<s:br/>
      Nulla sed metus facilisis, elementum arcu a, euismod est.<s:br/>
      Vivamus quis quam nec sapien accumsan luctus sit amet a magna.<s:br/>
      Vivamus eu erat ac est ullamcorper egestas eget nec mauris.<s:br/>
      Cras fringilla leo a risus luctus, eu volutpat diam luctus<s:br/>
      </s:content>
      </s:TextArea>

      <fx:Script><![CDATA[
      import flashx.textLayout.edit.EditManager;
      import flashx.textLayout.edit.SelectionState;
      import flashx.textLayout.elements.TextFlow;
      import flashx.textLayout.formats.TextLayoutFormat;

      import mx.events.FlexEvent;

      private function OnCreationComplete(event:FlexEvent):void

      { SetRegionColor(txt.textFlow, 5, 6, 0xB9CCFF); }

      public function SetRegionColor(objFlow:TextFlow, iStart:int, iEnd:int, iBackgroundColor:*, nBgAlpha:Number = 1):void
      {
      try
      {
      var objFormat:TextLayoutFormat = new TextLayoutFormat();
      objFormat.backgroundColor = iBackgroundColor;
      objFormat.backgroundAlpha = nBgAlpha;

      var objSelection:SelectionState = new SelectionState(objFlow, iStart, iEnd);

      if(objFlow.interactionManager == null || objFlow.interactionManager is EditManager == true)

      { var objManager:EditManager = objFlow.interactionManager as EditManager; objManager.applyFormat(objFormat, objFormat, objFormat, objSelection); }

      else

      { throw new Error("TextFlow is Not Editable"); }

      }
      catch(objError:Error)

      { trace("DocColorUtils::SetRegionColor Error: " + objError.message, objError); }

      }

      ]]></fx:Script>

        Attachments

        1. TLFApplyFormat_SDK4.10.png
          20 kB
          Jason Taylor
        2. TLFApplyFormat_SDK4.9.png
          19 kB
          Jason Taylor

          Activity

            People

            • Assignee:
              aharui Alex Harui
              Reporter:
              jtthegeek Jason Taylor
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: