That should do it, but the reference requirement is tricky.  It depends
on what the OP is trying to do.  There is not "a" text node for an
element node, there can be many text nodes, and if you append a text
node then it is new text node and not a changed text node.  

 

If you had an element node with one text node, say "Text Node", then to
append a text node you could probably do this:

parentElement.text()[parentElement.text().length()] = "newTextNode";
//length would be the index of the new node

 

Then, 

trace(parentElement.text();  //result: Text NodenewTextNode, because
there is an implicit toString

trace(parentElement.text()[0];  //result: Text Node

trace(parentElement.text()[1];  //result: newTextNode

 

Tracy

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Daniel Freiman
Sent: Friday, October 24, 2008 12:05 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Setting text on a text node in e4x

 

does this do it?

parentElement.text()[index] = "newText";

- Daniel Freiman

On Fri, Oct 24, 2008 at 11:48 AM, Mark Carter <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:


Hi - So, I know how to append a text node to an (parent) element, and
how to
replace a text node with a new text node (based on a specified string),
but
how do I set text on a text node?

In my situation it is very important that the reference to the text node
object is the same before and after this operation, so simply replacing
the
text node is not an option for me.
-- 
View this message in context:
http://www.nabble.com/Setting-text-on-a-text-node-in-e4x-tp20152621p2015
2621.html
<http://www.nabble.com/Setting-text-on-a-text-node-in-e4x-tp20152621p201
52621.html> 
Sent from the FlexCoders mailing list archive at Nabble.com.

 

 

Reply via email to