A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: comparing simple button instance name to XML child node

  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    5

    comparing simple button instance name to XML child node

    I want Montana data to appear when I click the state of Montana (and so on throughout the 50 states). Montana is the instance name of my simple button on the state of Montana.

    Something's not quite right about this line of code:

    if (pEvent.target == myXML.statename[i]) { ...then do something ...}

    The code works fine if I say
    if (pEvent.target == Montana)

    Do I have to convert the myXML node value to text or something?

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    What does the trace(myXML.statename[i]); give?
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    May 2008
    Posts
    5

    Montana

    trace(myXML.statename[i]) outputs Montana, which is correct (it's reading statename from my XML file).

    trace(pEvent.target) outputs [object SimpleButton], which means that pEvent.target is an object, and I'll have to somehow to do some type casting to compare the instance name of this object to myXML.statename[i], which I'm assuming is a string.

    This is where I need help. I haven't been able to find any documentation that shows how to convert the instance name of an object to a string. How can I do this?

  4. #4
    Junior Member
    Join Date
    May 2008
    Posts
    5

    Thumbs up Solution

    if (pEvent.target.name == myXML.statename[i])

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