A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Compare vars with node values

  1. #1
    Member
    Join Date
    Jan 2003
    Location
    Netherlands
    Posts
    46

    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

  2. #2
    Milk n' 2 shugaz Paleez. Sven Texas's Avatar
    Join Date
    Mar 2003
    Location
    Leeds, UK
    Posts
    158
    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"

  3. #3
    Member
    Join Date
    Jan 2003
    Location
    Netherlands
    Posts
    46
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center