I’m not getting this quite right - I need to check and see if the last item in the loop “termSprite_7” has its visibility turned off. If so, an animation can start:
var lastItemNumber = Glossary.glossaryArr.length - 1;
glossarySprites = new Sprite;
for (var i:int=0; i < Glossary.glossaryArr.length; i++) {
var term:String = Glossary.glossaryArr*.term;
var termSprite:MovieClip = new MovieClip;
var termTextField:TextField = createText(term,linkFormat,termSprite,0,0,275);
termSprite.name = "termSprite_" + i;
termSprite.x = 50;
termSprite.y = 57 + i * 23;
termSprite.itemNum = i;
termSprite.addEventListener(MouseEvent.CLICK,clickAnswer);
termSprite.addEventListener(MouseEvent.ROLL_OVER,termRollOver);
termSprite.addEventListener(MouseEvent.ROLL_OUT,termRollOut);
termSprite.buttonMode = true;
termSprite.visible = false;// Set visibility to false for animation
glossarySprites.addChild(termSprite);
// If last item is now invisible, start animation
if (MovieClip(getChildByName("termSprite_" + lastItemNumber)).visible == false) {
trace("Yes");
init();
}
}
addChild(glossarySprites);
The IF conditional is never reached so my syntax is wrong. Anyone see the problem?