# Please help

**URL:** https://forum.kirupa.com/t/please-help/191952
**Category:** Uncategorized
**Created:** [June 24, 2006, 8:17am UTC](https://forum.kirupa.com/t/please-help/191952 "2006-06-24T08:17:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rajeshambady](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@rajeshambady](https://forum.kirupa.com/u/rajeshambady)
#### Post date: [June 24, 2006, 8:17am UTC](https://forum.kirupa.com/t/please-help/191952/1 "2006-06-24T08:17:13Z")

</div>

Hi,

Iam loading the attribute values of from an XML file and according to the number of nodes I am creating movieclips.

Inside the movie clip I am creating squares and filling the color value from the XML.

Now the problem is that I want to trace the color value of the first square if I click on that … and trace the second color value if I click on the second square(movieclip).

Here is my code…

importColorValue = new XML();  
importColorValue.ignoreWhite = true;  
importColorValue.onLoad = function(success)  
{  
if (success)  
{  
var depth = 0;  
var nextY = 10;  
count = 0;

var colorvalue = importXMLtemplate.firstChild.firstChild;  
var attr = colorvalue.attributes;  
var color = attr.name1;  
var lengthofnodes = (importColorValue.firstChild.childNodes.length);  
var nodes = importColorValue.firstChild.childNodes  
for(i = 0; i\<lengthofnodes - 1; i++){  
result = nodes\*.attributes.names;  
var colorpallete:MovieClip = color\_mc.createEmptyMovieClip(“square\_mc” + i, color\_mc.getNextHighestDepth());  
colorpallete.beginFill(result);  
colorpallete.moveTo(10, 10);  
colorpallete.lineTo(40, 10);  
colorpallete.lineTo(40, 40);  
colorpallete.lineTo(10, 40);  
colorpallete.lineTo(10, 10);  
colorpallete.endFill();

colorpallete.\_x = 10;  
colorpallete.\_y = i \* 40;

colorpallete.onPress = function() {  
trace(i);  
}  
}  
}

//Now when I am clicking on each movieclip the value of i is tracing as 4 only, for every movieclip…  
How can I get each movieclip different values… means 1 for first movieclip… 2 for second movieclip etc…

I had tried with storing the values in array and all… but I don’t know it is not working

Here is the screenshot I am attaching how the output look like  
Attached Thumbnails[![](http://www.actionscript.org/forums/attachment.php3?attachmentid=18410&stc=1&thumb=1&d=1151129048)](http://www.actionscript.org/forums/attachment.php3?attachmentid=18410&d=1151129048)
