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

TextFlowElement parent nulled when addChild method used via parent reference

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Apache Flex 4.14.0
    • Apache Flex 4.15.0
    • TLF

    Description

      Example application below. This worked fine in version 4.13.0

      <?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"
                     applicationComplete="_this_applicationCompleteHandler(event)" frameRate="60"
                     backgroundAlpha="0">
      
      	<fx:Script>
      		<![CDATA[
      		import flashx.textLayout.elements.FlowElement;
      		import flashx.textLayout.elements.SpanElement;
      		import flashx.textLayout.elements.TextFlow;
      
      		import mx.events.FlexEvent;
      
      		import spark.utils.TextFlowUtil;
      
      		protected function _this_applicationCompleteHandler(event:FlexEvent):void
      		{
      			var flow:TextFlow = TextFlowUtil.importFromXML(xml);
      
      			var span:SpanElement = new SpanElement();
      			var target:FlowElement = flow.getElementByID("SpanElementId") as SpanElement;
      
      			// target.parent is instance of ParagraphElement
      			trace("EngineTesting._this_applicationCompleteHandler", target.parent);
      
      			target.parent.addChild(span);
      
      			// target.parent has been set to null when it should still reference the ParagraphElement
      			trace("EngineTesting._this_applicationCompleteHandler", target.parent);
      
      			richText.textFlow = flow;
      		}
      		]]>
      	</fx:Script>
      
      	<fx:Declarations>
      		<fx:XML id="xml">
      			<div>
      				<p><span id="SpanElementId" uid="5501" width="250" height="180"/></p>
      				<p>Hello World.</p>
      			</div>
      		</fx:XML>
      	</fx:Declarations>
      	
      	<s:RichText width="100%" id="richText"/>
      	
      </s:Application>
      

      Attachments

        Activity

          People

            harbs Harbs
            alexpalombaro Alessandro Palombaro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: