hi all
I am having a problem targeting a movieclip that i create using createEmptyMovieClip.
Let me explain a little first
What i am doing is reading in an xml document that has image names in.
Once i have read the xml into flash i push the image titles and image names into an array.
This all works fine
Then i create seperate movieclips for each image and load the image into the new moviclip and place them on the stage.
This again all works fine and the seperate images load into there seperate empty movie clips and place themself onto the stage where i stipulate
the problem comes in is when i want to target these clips so i can for example click on them. the movieclips instance names are as follows image1,image2,image3…
they should all be in the root zone so to my understanding to get each of them to do something i would target it as follows
_root.image1.onRelease = function()
{
trace(“Clicked Image”);
}
but this does not work… why?
my code is below … please someone help me…
images_xml = new XML();
images_xml.ignoreWhite = true;
images_xml.onLoad = function(sucess) {
if (sucess) {
processImages(images_xml);
}
};
images_xml.load(‘images.xml’);
function processImages(xmlDoc_xml) {
image = [];
description = [];
total = xmlDoc_xml.firstChild.childNodes.length;
for(i=0; i<total; i++)
{
image* = xmlDoc_xml.firstChild.childNodes*.childNodes[0].childNodes[0].nodeValue;
description* = xmlDoc_xml.firstChild.childNodes*.childNodes[1].childNodes[0].nodeValue;
}
placeImage();
}
function placeImage()
{
for(n=0; n<total; n++)
{
this.createEmptyMovieClip("image" +n, this.getNextHighestDepth());
}
clipNum = 0;
xPos = 65;
yPos = 10;
for(m=0; m<total; m++)
{
_root["image" +m].loadMovie(image[m], this.getNextHighestDepth());
_root["image" +m]._x= xPos * m;
if(clipNum < 7)
{
_root["image" +m]._y= yPos;
}
else if(clipNum >= 7 )
{
_root["image" +m]._y= yPos + 65;
_root["image" +m]._x= xPos * (m - 7);
}
clipNum++;
}
}
_root.image1.onRelease = function()
{
trace(“Clicked Image”);
}
thanks