again, can anyone point me in the right direction here? We can't apply any formatting to a range of textflow in Flex 4.10. This issue is specific to the 4.10 SDK. This sample produces the error. Stackoverflow question here: http://stackoverflow.com/questions/19168415/applying-formatting-to-a-character-range-in-textflows-in-flex-4-10-sdk
Our app relies on highlighting text, so this is a pretty major issue for us at the momment. ~ JT <?xml version="1.0"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="OnCreationComplete(event)"> <s:TextArea width="100%" height="100%" id="txt" editable="true"> <s:content> Lorem ipsum dolor sit amet, consectetur adipiscing elit.<s:br/> Vivamus eu erat ac est ullamcorper egestas eget nec mauris.<s:br/> </s:content> </s:TextArea> <fx:Script><![CDATA[ import flashx.textLayout.edit.EditManager; import flashx.textLayout.formats.TextLayoutFormat; import mx.events.FlexEvent; private function OnCreationComplete(event:FlexEvent):void { var objFormat:TextLayoutFormat = new TextLayoutFormat(); objFormat.backgroundColor = 0xB9CCFF; txt.selectRange(5, 8); var objManager:EditManager = txt.textFlow.interactionManager as EditManager; objManager.applyFormat(objFormat, objFormat, objFormat); } ]]></fx:Script> </s:Application> -----Original Message----- From: Jason Taylor [mailto:ja...@dedoose.com] Sent: Tuesday, October 01, 2013 1:29 PM To: dev@flex.apache.org Subject: RE: Issue with TLF applyFormat in Flex 4.10 created issue https://issues.apache.org/jira/browse/FLEX-33791 with images to see the issue -----Original Message----- From: Jason Taylor [mailto:ja...@dedoose.com] Sent: Tuesday, October 01, 2013 1:17 PM To: dev@flex.apache.org Subject: Issue with TLF applyFormat in Flex 4.10 Hi guys, please point me to the right place if this is the wrong. I have encountered what appears to be an error in TLF present in the 4.10 SDK (checked multiple flash player target versions) in regard to EditManager.applyFormat in the selection state I am specifying a small character range, but the format gets applied well beyond that range. Attached are images from the exact same code (provided below) with drastically different results. Thank you for any assistance & advise. ~ Jason Taylor <?xml version="1.0"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="OnCreationComplete(event)"> <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> </s:Application>