# XML .. Loaded image onRelease

**URL:** <https://forum.kirupa.com/t/xml-loaded-image-onrelease/263988>\
**Category:** Uncategorized\
**Created:** [June 21, 2008, 2:43pm UTC](https://forum.kirupa.com/t/xml-loaded-image-onrelease/263988 "2008-06-21T14:43:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [June 21, 2008, 2:43pm UTC](https://forum.kirupa.com/t/xml-loaded-image-onrelease/263988/1 "2008-06-21T14:43:37Z")

</div>

here’s my xml code … \>  
Why won’t my images activate the ‘trace’ function when I click them? The pictures load correctly, so everything else is ok …

```auto
xmlData = new XML();
xmlData.ignoreWhite = true;    
xmlData.load("links.xml");
xmlData.onLoad = LoadXML;
function LoadXML(ok)
{
    if(ok)
    {
        myFunction(this);
    }
    else
    {
        trace("Error with code");
    }
}

function myFunction(xmlData)
{
    xmlNode = xmlData.firstChild.childNodes;
    var cardTotal:Number = xmlNode.length;
    link = *;
    
    for (i=0;i<cardTotal;i++)
    {
        link* = xmlNode*.attributes.picture;
        _root.createEmptyMovieClip("link"+i+"_mc",i);
        _root["link"+i+"_mc"].loadMovie(link*);
        _root["link"+i+"_mc"].onRelease = function()
        {
            trace(link*);
        }
    }
}

```

thanks!!!

---

<div class="post-metadata">

**Author:** ![Macsy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/macsy/32/3238_2.png) [@Macsy](https://forum.kirupa.com/u/Macsy)\
**Post date:** [June 21, 2008, 3:45pm UTC](https://forum.kirupa.com/t/xml-loaded-image-onrelease/263988/2 "2008-06-21T15:45:13Z")

</div>

becouse they aint loaded yet.  
please use the search function.  
This question is in every 5th topic

---

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [June 21, 2008, 6:16pm UTC](https://forum.kirupa.com/t/xml-loaded-image-onrelease/263988/3 "2008-06-21T18:16:38Z")

</div>

I was hoping for someone to be a little more helpful. You shouldn’t have fallen for the trap which was stipulated in the title of the post, enabling you to be bugged by the same question again.

I just don’t understand why it hasn’t loaded yet. The images yes maybe - but the MovieClips that have been created to contain the images will have been invoked by that point … and thus should link to its according data. The XML data has been loaded.

I have tried searching the Kirupa help, and the XML gallery tutorial doesn’t help me with my eventual outcome …

Any other ideas folks! ? 🙂

---

<div class="post-metadata">

**Author:** ![Macsy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/macsy/32/3238_2.png) [@Macsy](https://forum.kirupa.com/u/Macsy)\
**Post date:** [June 21, 2008, 6:30pm UTC](https://forum.kirupa.com/t/xml-loaded-image-onrelease/263988/4 "2008-06-21T18:30:40Z")

</div>

right now i tried to use the searchfunction but it didnt work

to correct this you need to load the mc’s with moviecliploader and use onloadinit() to apply functions to the mcs
