# Syntax for Referring to MovieClip

**URL:** https://forum.kirupa.com/t/syntax-for-referring-to-movieclip/277627
**Category:** flash
**Created:** [December 15, 2008, 4:06am UTC](https://forum.kirupa.com/t/syntax-for-referring-to-movieclip/277627 "2008-12-15T04:06:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Pherank](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pherank](https://forum.kirupa.com/u/Pherank)
#### Post date: [December 15, 2008, 4:06am UTC](https://forum.kirupa.com/t/syntax-for-referring-to-movieclip/277627/1 "2008-12-15T04:06:56Z")

</div>

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:

```auto

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?
