Hi everyone.
I am having such a hard time with this.
I am trying to attach URL’s to a button in my Flash movie for a photo gallery. Photo, description and URL’s will be generated from a XML file.
The action script is as follows:
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
var xml:XML;
function onLoaded(e:Event): void
{
xml = new XML(e.target.data);
var il:XMLList = xml.photo.link;
//trace(il[0]);
photolink_btn.addEventListener(MouseEvent.CLICK, gotolink);
function gotolink(event:MouseEvent):void {
var gotolink:URLRequest = new URLRequest();
navigateToURL(gotolink,"_blank");
}
}
loader.load(new URLRequest(“flashmo_205_photo_list_01.xml”));
And the XML file looks like this:
<?xml version=“1.0” encoding=“utf-8”?>
<photos>
<photo>
<filename>animals_400x260_01.jpg</filename>
<title>House</title>
<description>Description:</description>
<link>http://www.yahoo.ca</link>
</photo>
<photo>
<filename>animals_400x260_02.jpg</filename>
<title>New House</title>
<description>Description:</description>
<link>http://www.yahoo.ca</link>
</photo>
<photo>
<filename>animals_400x260_03.jpg</filename>
<title>New House</title>
<description>Description:</description>
<link>yahoo.ca</link>
</photo>
<photo>
<filename>animals_400x260_04.jpg</filename>
<title>New House</title>
<description>Description:</description>
<link>http://www.yahoo.ca</link>
</photo>
<photo>
<filename>animals_400x260_05.jpg</filename>
<title>New House</title>
<description>Description:</description>
<link>http://www.yahoo.ca</link>
</photo>
</photos>
I get no errors when testing the movie, except when clicking on the button (that should be going to the URL from the XML file), I get the following error in the Output window:
TypeError: Error #2007: Parameter url must be non-null.
at global/flash.net::navigateToURL()
at Function/<anonymous>()
What am I doing wrong…??? Can anyone help. It would be GREATLY appreciated!!!
Thanks in advance!