# For loop question

**URL:** <https://forum.kirupa.com/t/for-loop-question/307828>\
**Category:** Uncategorized\
**Created:** [April 11, 2010, 3:19pm UTC](https://forum.kirupa.com/t/for-loop-question/307828 "2010-04-11T15:19:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vascoraf](https://avatars.discourse-cdn.com/v4/letter/v/c67d28/32.png) [@vascoraf](https://forum.kirupa.com/u/vascoraf)\
**Post date:** [April 11, 2010, 3:19pm UTC](https://forum.kirupa.com/t/for-loop-question/307828/1 "2010-04-11T15:19:55Z")

</div>

Hello.

I have 8 mc’s on stage, “mc1” to “mc8”, and I use a for loop to create loader to load a pic and masks for all of those, and it all works fine.

I just can’t figure out how to control some properties of the created mask’s.

```auto

var thumb_count:int = 8;
var loader:Loader;
var mascara:Sprite;

for(var i:int = 1; i <= thumb_count; i++){
    loader = new Loader();
    mascara = new Sprite();
    mascara.graphics.beginFill(0xFF0000);
    mascara.graphics.drawRect(0, 0, 225, 170);
    mascara.graphics.endFill();
    this["mc"+i].addChild(mascara);
    this["mc"+i].mask = mascara;
    loader.load(new URLRequest(i + ".jpg"));
    this["mc"+i].addChild(loader);
    this["mc"+i].buttonMode = true;
    
    this["mc"+i].addEventListener(MouseEvent.MOUSE_UP, expand);
}

function expand (e:MouseEvent):void{
        mascara.scaleX = 2;
        mascara.scaleY = 2;
}

```

This gives two problems:

- the mask that scales is the one on the last mc, and not the one on the mc that is clicked.  
-only the first mc is clickable, the others seem disabled.

Also tried:

```auto

function expand (e:MouseEvent):void{
        e.target.mascara.scaleX = 2;
        e.target.mascara.scaleY = 2;
}

```

and get this error when I click:

```auto

ReferenceError: Error #1069: Property mascara not found on flash.display.Loader and there is no default value.
    at trab2_fla::MainTimeline/expand()

```
