# Xml problem adding link

**URL:** <https://forum.kirupa.com/t/xml-problem-adding-link/304008>\
**Category:** Uncategorized\
**Created:** [January 30, 2010, 4:13pm UTC](https://forum.kirupa.com/t/xml-problem-adding-link/304008 "2010-01-30T16:13:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drops](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@drops](https://forum.kirupa.com/u/drops)\
**Post date:** [January 30, 2010, 4:13pm UTC](https://forum.kirupa.com/t/xml-problem-adding-link/304008/1 "2010-01-30T16:13:16Z")

</div>

I’m very new in as3. I try to put a link on images loaded from xml but I can’t get it done. This script puts the last link from xml.

Can somebody help me? give me some suggestions? Anything?

The xml looks like this:

```auto
<?xml version="1.0" encoding="UTF-8"?>
<slideshow>
    <image src="1.jpg" link="http://www.google.ro"/>
    <image src="2.jpg" link="http://www.gsp.ro"/>
    <image src="3.jpg" link="http://www.aol.com"/>
    <image src="4.jpg" link="http://www.yahoo.com"/>
</slideshow>

```

and the code in flash

```auto
        function ParseData(imagini:XML):void {
            var axaX = 0;
            var axaY = 0;
            var imaginiList:XMLList = imagini.image;
            for each (var imaginiElement:XML in imaginiList) {
                var imageLoader:Loader = new Loader();
                var elm = imaginiElement.@src;
                var link = imaginiElement.@link;
                trace(link);
                imageLoader.load(new URLRequest(elm));
                imageLoader.addEventListener(MouseEvent.CLICK,clickHandler);
                addChild(imageLoader);
                if(axaX <= 120) { 
                    imageLoader.x = axaX;
                    axaX +=120;
                    imageLoader.y = axaY;
                    axaY +=120;
                    axaY = imageLoader.y;
                } else {
                    axaX = 0;
                    imageLoader.x = axaX;
                    axaX = axaY+120;
                    axaY = axaY+120;
                    imageLoader.y = axaY;
                }

        function clickHandler(event:MouseEvent):void {
            var request:URLRequest = new URLRequest(link);
            navigateToURL(request);
        }

```
