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.
Code:
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:
Code:
function expand (e:MouseEvent):void{
e.target.mascara.scaleX = 2;
e.target.mascara.scaleY = 2;
}
and get this error when I click:
Code:
ReferenceError: Error #1069: Property mascara not found on flash.display.Loader and there is no default value.
at trab2_fla::MainTimeline/expand()