I have an array that holds a list of items. In a movie clip, I have that same list as the frame labels. I’m using a for loop to iterate through the array and then assigning event listeners so that when you roll over an icon, it sends the movie clip to the right frame label (matching the item in the array).
However, the code I have now only returns the first match and not any of the others. Here’s my code:
for (var j:uint = 0; j<interiorCallouts.length; j++) {
featureTextArray[j].text = interiorCallouts[j];
featureArray.length = interiorCallouts.length;
featureArray[j].visible = true;
trace(interiorCallouts[j]);
featureArray[j].addEventListener(MouseEvent.ROLL_OVER, showCallout);
featureArray[j].addEventListener(MouseEvent.ROLL_OUT, hideCallout);
function showCallout(e:MouseEvent):void {
callouts_mc.visible = true;
callouts_mc.gotoAndStop(interiorCallouts[j]);
}
function hideCallout(e:MouseEvent):void {
callouts_mc.visible = false;
}
}
See the showCallout function. I’m using the interiorCallouts array to match the frame label in the callouts_mc, but I’m only getting the first match. None of the others.