I’m having trouble figuring out how to target a series of movie clips i’m attaching to my movie.
Here’s the idea:
I’m loading some xml for a slideshow and i’m generating a series of dots at the bottom of the screen to indicate how many steps are in the slideshow and the circle is meant to highlight your current position as you step through the presentation.
the MC for the dots is two keyframes with a different color and a stop action on each frame.
Here’s the rundown of the code:
- There’s nothing weird here, i’m just bringing the xml in
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("xml/data.xml");
- Here is the loadXML function i reference in the xml.Data.onLoad above:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
// the total and stepArea vars are used to space the dots. total is also used in a loop.
total = xmlNode.childNodes[1].childNodes.length;
stepArea = (Stage.width/2) - Number(titleBar_mc.stepContainer_mc._x);
// here is where i'm attaching the dots.
for (i=0; i<total; i++) {
//render the step dots
var q = stepContainer_mc.attachMovie("step", "step"+i, i);
q._x = i*(stepArea/total);
q._height = (stepArea/total)/4;
q._width = q._height;
}
firstImage();
} else {
content = "file not loaded!";
}
}
Okay so now i have some dots with the instance names, step0, step1 etc. right? And at the end of my loadXML function you see the firstImage(); function. This is where my problem is, how do i target the first (step0) instance? I have no problem when I write “step0.gotoAndStop(2);” but I need to figure out how to use a variable to keep moving it along when i make my next and last functions for the slideshow.
- Here is the firstImage function:
var p = 0;
function firstImage() {
image_mc._alpha = 0;
image_mc.loadMovie(image[p], 1);
//this is where my problem is. how do i target the step the same way i target the image? do i have to go back and do something in the loadXML for loop?
stepContainer_mc.step[p].gotoAndStop(2);
}