Skip to main content
Inspiring
March 19, 2010
Answered

Are new lines supposed to break Rich Text?

  • March 19, 2010
  • 1 reply
  • 680 views

Can you not enter linebreaks? When I do I get this error message:

ArgumentError: NewElement not of a type that this can be parent of
    at flashx.textLayout.elements::FlowGroupElement/replaceChildren()
    at flashx.textLayout.elements::FlowGroupElement/set mxmlChildren()


It looks like the element that it is choking on is "\n\t\t\t\t" in the first line break in the MXML:

    <s:RichEditableText x="93" y="22" editable="false">
        <s:TextFlow blockProgression="tb" columnCount="inherit" columnGap="inherit" columnWidth="inherit" locale="en_US" paddingBottom="inherit" paddingLeft="inherit" paddingRight="inherit" paddingTop="inherit" verticalAlign="inherit" whiteSpaceCollapse="collapse" xmlns="http://ns.adobe.com/textLayout/2008"><s:p direction="ltr" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="start" textAlignLast="start" textIndent="0" textJustify="interWord"><s:a color="#ae7c4b" fontFamily="Myriad Pro" fontSize="17" fontStyle="normal" fontWeight="normal" kerning="auto" lineHeight="120%" textAlpha="1" textRotation="auto" trackingRight="2%" click="linkelement1_clickHandler(event)" textDecoration="none">{data.label}</s:a><s:span color="#cccccc" fontFamily="Myriad Pro" fontSize="17" fontStyle="normal" fontWeight="normal" kerning="auto" lineHeight="120%" textAlpha="1" textRotation="auto" trackingRight="2%"> has posted</s:span><s:span color="#ae7c4b" fontFamily="Myriad Pro" fontSize="17" fontStyle="normal" fontWeight="normal" kerning="auto" lineHeight="120%" textAlpha="1" textRotation="auto" trackingRight="2%"> </s:span><s:span color="#0099ff" fontFamily="Myriad Pro" fontSize="17" fontStyle="normal" fontWeight="normal" kerning="auto" lineHeight="120%" textAlpha="1" textRotation="auto" trackingRight="2%">2 photos on Design Team</s:span></s:p></s:TextFlow>
    </s:RichEditableText>
This topic has been closed for replies.
Correct answer robin_briggs

I think you're missing the "textFlow" element. I tried this and it worked fine:

<s:Application name="school"

explicitMinWidth="100"

explicitMinHeight="100"

xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/halo">

<fx:Script>

<![CDATA[

import flashx.textLayout.elements.LinkElement;

import flashx.textLayout.events.FlowElementMouseEvent;

import mx.controls.Alert;

public var data:Object;

protected function linkelement1_clickHandler(evt:FlowElementMouseEvent):void {

var linkEl:LinkElement = evt.flowElement as LinkElement;

Alert.show("The '" + linkEl.getFirstLeaf().text + "' link would have gone to " + linkEl.href + " in a " + linkEl.target + " window, but it was cancelled.", "Fun with hyperlinks");

evt.stopImmediatePropagation();

evt.preventDefault();

}

]]>

</fx:Script>

<s:RichEditableText x="93" y="22" editable="false"><s:textFlow>

<s:TextFlow blockProgression="tb" columnCount="inherit" columnGap="inherit" columnWidth="inherit" locale="en_US" paddingBottom="inherit" paddingLeft="inherit" paddingRight="inherit" paddingTop="inherit" verticalAlign="inherit" whiteSpaceCollapse="collapse" xmlns="http://ns.adobe.com/textLayout/2008">

<s:p direction="ltr" textJustify="interWord"><s:a color="#ae7c4b" fontFamily="Myriad Pro" fontSize="17"  trackingRight="2%" click="linkelement1_clickHandler(event)">{data.label}</s:a><s:span color="#cccccc" fontFamily="Myriad Pro" fontSize="17" trackingRight="2%"> has posted</s:span><s:span color="#ae7c4b" fontFamily="Myriad Pro" fontSize="17"  trackingRight="2%"> </s:span><s:span color="#0099ff" fontFamily="Myriad Pro" fontSize="17"  trackingRight="2%">2 photos on Design Team</s:span></s:p>

</s:TextFlow>

</s:textFlow>

</s:RichEditableText>

</s:Application>

- robin

1 reply

robin_briggsCorrect answer
Adobe Employee
March 19, 2010

I think you're missing the "textFlow" element. I tried this and it worked fine:

<s:Application name="school"

explicitMinWidth="100"

explicitMinHeight="100"

xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/halo">

<fx:Script>

<![CDATA[

import flashx.textLayout.elements.LinkElement;

import flashx.textLayout.events.FlowElementMouseEvent;

import mx.controls.Alert;

public var data:Object;

protected function linkelement1_clickHandler(evt:FlowElementMouseEvent):void {

var linkEl:LinkElement = evt.flowElement as LinkElement;

Alert.show("The '" + linkEl.getFirstLeaf().text + "' link would have gone to " + linkEl.href + " in a " + linkEl.target + " window, but it was cancelled.", "Fun with hyperlinks");

evt.stopImmediatePropagation();

evt.preventDefault();

}

]]>

</fx:Script>

<s:RichEditableText x="93" y="22" editable="false"><s:textFlow>

<s:TextFlow blockProgression="tb" columnCount="inherit" columnGap="inherit" columnWidth="inherit" locale="en_US" paddingBottom="inherit" paddingLeft="inherit" paddingRight="inherit" paddingTop="inherit" verticalAlign="inherit" whiteSpaceCollapse="collapse" xmlns="http://ns.adobe.com/textLayout/2008">

<s:p direction="ltr" textJustify="interWord"><s:a color="#ae7c4b" fontFamily="Myriad Pro" fontSize="17"  trackingRight="2%" click="linkelement1_clickHandler(event)">{data.label}</s:a><s:span color="#cccccc" fontFamily="Myriad Pro" fontSize="17" trackingRight="2%"> has posted</s:span><s:span color="#ae7c4b" fontFamily="Myriad Pro" fontSize="17"  trackingRight="2%"> </s:span><s:span color="#0099ff" fontFamily="Myriad Pro" fontSize="17"  trackingRight="2%">2 photos on Design Team</s:span></s:p>

</s:TextFlow>

</s:textFlow>

</s:RichEditableText>

</s:Application>

- robin

thx1138Author
Inspiring
March 19, 2010

Thank you so much that was it!