# Loops and Functions

**URL:** <https://forum.kirupa.com/t/loops-and-functions/229336>\
**Category:** flash\
**Created:** [June 16, 2007, 12:11am UTC](https://forum.kirupa.com/t/loops-and-functions/229336 "2007-06-16T00:11:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Exodar](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@Exodar](https://forum.kirupa.com/u/Exodar)\
**Post date:** [June 16, 2007, 12:11am UTC](https://forum.kirupa.com/t/loops-and-functions/229336/1 "2007-06-16T00:11:57Z")

</div>

I’ve attempted to add functions to some movieclips created with a loop (and sadly failed). Here’s how I did it, and i’m just wondering if someone can point out where i went wrong.

Here is the basic structure of the code:

```auto
 
function onEnterFrame() {
for (i = 0; i < count; i++) {
       myMovieClips = this["myMovieClip" + i];
 
       if (condition = true) {
          //i'm pretty sure that the problem is right here:
          myMovieClips.doSomething();
          myMovieClips.doSomethingElse();
         }
}
}
 
//then i have my functions
function doSomething() {
 
}
 
function doSomethingElse() {
 
}

```

The functions that i created aren’t getting triggered for some reason.  
Any help with this would be appreciated.
