Note that there are some explanatory texts on larger screens.

plurals
  1. POflex 4.6 parsing htmlText object with CDATA only last object displaying
    text
    copied!<p>I am trying to update multiple <code>&lt;mx:text&gt;</code> objects with a <code>htmlText</code> string. The problem I am having is only the last <code>&lt;mx:text&gt;</code> object is becoming visible when the data changes.</p> <p>Am I missing something basic on the <code>&lt;mx:text&gt;</code> tags?</p> <p>using flex 4.6</p> <p>thx Art</p> <p>test1.html</p> <pre><code>&lt;rtnA&gt;&lt;![CDATA[ &lt;font color="#0000ff" face="helvetica" size="15" &gt;This is rtnA&lt;/font&gt; ]]&gt;&lt;/rtnA&gt; &lt;rtnB&gt;this is rtnB&lt;/rtnB&gt; &lt;rtnC&gt;this is rtnC&lt;/rtnC&gt; &lt;rtnD&gt;&lt;![CDATA[ &lt;font color="#aa00aa" face="Arial" size="15" &gt;This is &lt;/font&gt;&lt;font color="#0000ff" face="helvetica" size="15" &gt;rtnD&lt;/font&gt; ]]&gt;&lt;/rtnD&gt; </code></pre> <p>test1.mxml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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" minWidth="955" minHeight="600"&gt; &lt;s:layout&gt; &lt;s:BasicLayout/&gt; &lt;/s:layout&gt; &lt;fx:Declarations&gt; &lt;s:HTTPService id="sendMe" url="http://myUrl.com/test1.html" useProxy="false" method="POST" resultFormat="object" &gt; &lt;/s:HTTPService&gt; &lt;/fx:Declarations&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.core.FlexGlobals; import mx.geom.RoundedRectangle; import mx.rpc.events.ResultEvent; import spark.events.TextOperationEvent; [Bindable] public var meta:Object; public function send_data(event:MouseEvent, funRtn):void { var params:Object = new Object(); if(funRtn == "A"){ sendMe.send(); sendMe.addEventListener("result",getResA); } if(funRtn == "B"){ sendMe.send(); sendMe.addEventListener("result",getResB); } } public function getResA(event:ResultEvent) : void{ sendMe.removeEventListener("result",getResA); status.text="getResA"; meta = event.result; if(meta.hasOwnProperty("rtnA")){ if(meta.rtnA != null){ rtnAtxt.htmlText = meta.rtnA; } } if(meta.hasOwnProperty("rtnD")){ if(meta.rtnD != null){ rtnDtxt.htmlText= meta.rtnD; } } } public function getResB(event:ResultEvent) : void{ sendMe.removeEventListener("result",getResB); status.text="getResB"; meta = event.result; if(meta.hasOwnProperty("rtnB")){ if(meta.rtnB != null){ rtnAtxt.htmlText = meta.rtnB; } } if(meta.hasOwnProperty("rtnC")){ if(meta.rtnC != null){ rtnDtxt.htmlText= meta.rtnC; } } } ]]&gt; &lt;/fx:Script&gt; &lt;s:SkinnableContainer id="lisc" width="100%" height="100%" &gt; &lt;s:Label id="status"&gt; &lt;/s:Label&gt; &lt;mx:Text id="rtnAtxt" x="20" width="150" y="20" height="50" &gt; &lt;/mx:Text&gt; &lt;mx:Text id="rtnDtxt" x="20" width="150" y="20" height="50" &gt; &lt;/mx:Text&gt; &lt;s:Form id="myForm" x="20" width="150" y="90" height="100"&gt; &lt;s:FormItem&gt; &lt;s:Button id="myButtonA" width="50" height="20" label="go A" click="send_data(event, 'A')" /&gt; &lt;s:Button id="myButtonB" width="50" height="20" label="go B" click="send_data(event,'B')" /&gt; &lt;/s:FormItem&gt; &lt;s:FormItem&gt; &lt;/s:FormItem&gt; &lt;/s:Form&gt; &lt;/s:SkinnableContainer&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload