Hello all,
I have a situation where I am reading a wide variety of data from an XML file, and if a particular bit of data is not there, I simply want to hide a button.
Before I go further, all my XML data in and out works fine, that’s not a problem.
If I have this node in my XML:
<name1></name1>
read it in, assign to a variable and check that variable in the debugger I get this:
Variable _level0.assocImageName1 = undefined
This is fine. It has no value, so it’s undefined. Cool.
Now, if I do the most simple of If statements this check just doesn’t work. I’ve tried something like:
if (_root.assocImageName1 == undefined) {
_root.linked._visible = false;
} else {
break;
}
Now the odd thing, is that with quotes (“undefined”) or without, this doesn’t work reliably. It seems to just run right past the If and perform the hiding of the button regardless.
Also, if I put something in the XML like so:
<name1>data</name1>
I get this in the debugger:
Variable _level0.assocImageName1 = "data"
and check for that like this it doesn’t work:
if (_root.assocImageName1 == "data") {
but oddly enough, if I take the quotes off it does work. What’s going on there? I thought you also had to always use quotes when testing a string?
What’s going on here? This should be dead simple, shouldn’t it? What am I missing?