-
Compare vars with node values
Hi,
I got a global variable filled by a button release. On the other hand I got a value from a xml document. (nodevalue that is)
With this code I get trace to show me a couple of equal values
<code>
var myNodeValue = itemLevel .childNodes [counter02 ]. firstChild;
trace(myNodeValue);
trace(_global.groupID);
if(myNodeValue == _global.groupID){
trace("hit");
}
</code>
But flash doesn't see my nodevalue as the same type? of number as in the global var.
Has this got to do with the var type? int or string? if so, how to change that?
Thanks sooo much for helping me out here!
Frans-Jan
-
Milk n' 2 shugaz Paleez.
I think the problem is that flash sees the nodevalue as an object, so for example if you have something like this in xml
(mynode thing="cheese" /)
(i've used () instead of proper xml tags, for some reason they don't show up in this forum!!)
and nodevalue is pointing to that node, then you need
myVar = nodeValue.name;
(fills myVar with "mynode")
or
myVar = nodeValue.attributes.thing;
(fills myVar with "cheese"
-
Thanks for finding that out!
I found out that node values printed by trace can contain tag data, if you append .nodevalue it works, dunno why, but it does
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|