Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex: Modifying valueOf XML for node where hasSimpleContent()==true using ActionScript
    primarykey
    data
    text
    <p><a href="http://www.rigel222.com/Clip0021.jpg" rel="nofollow noreferrer" title="actual screenshot">alt text http://www.rigel222.com/Clip0021.jpg</a> All I want to do is modify the text value of the XML corresponding to the CURRENTLY SELECTED node in the tree. Everything is a piece of cake except actually changing 'abc' to 'xyz'.</p> <pre><code> [Bindable] public var xml:XML= &lt;rootnode&gt; Content A &lt;parentnode Name="value" Attr2="4"&gt; parent content1 &lt;childnode Name="child" Attr2="fun"&gt; child content &lt;/childnode&gt; parent content 2 &lt;/parentnode&gt; abc &lt;!-- Selected Node When Button Is Pressed--&gt; &lt;/rootnode&gt; ; private function XMLTreeLabel(node:Object):String{ if (XMLTree.dataDescriptor.isBranch(node)) { return(node.name()); } else { return(node.valueOf()); } } private function UpdateXMLContent():void { var Node:XML=XMLTree.selectedItem as XML; if ((Node.hasSimpleContent())&amp;&amp; (Node.nodeKind()=="text")&amp;&amp; (Node.valueOf()=="abc")) { Node='xyz' as XML; // I Get To This Line Of Code, // But It Is Impossible To MODIFY // The Value Of The Node // None of these ways work either: // XMLTree.selectedItem=XML('xyz'); // Node=XML('xyz'); // Node.text()[0]='xyz'; // Node.firstChild.nodeValue='xyz'; // Node.setChildren('xyz'); // Node[0]='xyz'; // Is changing the content of xml an unreasonable/impossible // expectation for Flex? } } </code></pre> <p>[... some code omitted...]</p> <pre><code> &lt;mx:Tree height="100%" width="100%" dataProvider="{xml}" labelFunction="XMLTreeLabel" id="XMLTree"&gt;&lt;/mx:Tree&gt; &lt;mx:Button x="185" y="335" label="Button" click="UpdateXMLContent()"/&gt; </code></pre> <p>P.S. I know I can say xml.rootnode.blahblahblah = whatever, but I need to modify the entry represented in the tree, and therefore cannot hard code the path to the node.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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