Forum Moderators: open

Message Too Old, No Replies

Jump menu URL

XML jump menu links not working - "undefined"

         

catcherintherye51

5:33 pm on Jun 21, 2006 (gmt 0)

10+ Year Member



I'm trying to create a jump menu that will take the user to another URL. To populate the combobox I use this:
var myData:XML = new XML ();
myData.ignoreWhite = true;
myData.load ("villaData.xml");
myData.onLoad = function (success:Boolean):Void
{
if (success)
{
var data:XMLNode = this.firstChild;
var children:Array = data.childNodes;
var numItems:Number = children.length;

for (var i:Number = 0; i < numItems; i++)
{
var child:XMLNode = children[i];
var name:String = child.attributes.name;
var link:String = child.attributes.link;
comboBox.addItem (name, link);
}
}
else
{
trace ("Error loading data");
}
};

And my XML looks like this:

<data>
<villa name="Villa Penasco" link="http://72.xx.xx.xx/proptest.asp?PID=202"/>
<villa name="Villa Taz" link="http://72.xx.xx.xx/proptest.asp?PID=109"/>
</data>

And lastly, in the first frame of the comboBox I have this:

on (change) {getURL(link);

}

I can hardcode the "link" above, for example on(change) {getURL("http://www.whatever.com"); and it works fine, but it's not recognizing the "link" variable that should be pulled from the XML.

Any ideas? Thanks!

[edited by: jatar_k at 6:12 pm (utc) on June 21, 2006]
[edit reason] obfuscated url [/edit]

oxbaker

5:55 pm on Jun 21, 2006 (gmt 0)

10+ Year Member



can you trace the link variable on your on change event and does it display properly?

mcm

catcherintherye51

6:11 pm on Jun 21, 2006 (gmt 0)

10+ Year Member



How would I trace it? Like this?

on (change) {trace(link);
}

If so, I tried that and nothing happens. Can you tell me the right way to trace the on change? (Yes, I'm new!)

Thanks!

[edited by: catcherintherye51 at 6:15 pm (utc) on June 21, 2006]

catcherintherye51

6:13 pm on Jun 21, 2006 (gmt 0)

10+ Year Member



OK... I did see that it does trace it with this method, and it says "undefined."

oxbaker

11:17 pm on Jun 21, 2006 (gmt 0)

10+ Year Member



ok that means that your not getting the variable passed to it from the XML, re-check your parsing function. put some traces in there to help you out.
mcm