# Calling on URL's from XML file

**URL:** <https://forum.kirupa.com/t/calling-on-urls-from-xml-file/324607>\
**Category:** flash\
**Created:** [August 29, 2011, 7:12pm UTC](https://forum.kirupa.com/t/calling-on-urls-from-xml-file/324607 "2011-08-29T19:12:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kristen33](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@kristen33](https://forum.kirupa.com/u/kristen33)\
**Post date:** [August 29, 2011, 7:12pm UTC](https://forum.kirupa.com/t/calling-on-urls-from-xml-file/324607/1 "2011-08-29T19:12:06Z")

</div>

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](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](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](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](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!
