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