What I have is an array of 3 pictures in a column, that expand on a MOUSE_OVER. I want the picture to be in front of the others on the MOUSE_OVER, but part of it is always beneath.
var thumbnails:Array = ["IMG_1258.JPG","IMG_1417.JPG","IMG_1428.JPG"];
var studioGallery:MovieClip = new MovieClip();
addChild(studioGallery);
for(var i:int = 0; i < thumbnails.length; i++){
var img:Loader = new Loader();
img.load(new URLRequest("images/"+thumbnails*));
img.x = 100;
img.y = 10 + i * 100;
img.alpha = 0;
img.scaleX = img.scaleY =.5;
studioGallery.addChild(img);
img.contentLoaderInfo.addEventListener(Event.COMPLETE, onReady);
img.addEventListener(MouseEvent.ROLL_OVER, onOver);
img.addEventListener(MouseEvent.ROLL_OUT, onOut);
}
function onReady(evt:Event):void {
var img:Loader = Loader(evt.currentTarget.loader);
img.content.x = -img.content.width / 2;
img.content.y = -img.content.height / 2;
Bitmap(img.content).smoothing = true;
img.addEventListener(Event.ENTER_FRAME, onFadeIn);
studioGallery.x = 200;
studioGallery.y = 200;
}
function onFadeIn(evt:Event):void {
var img:Loader = Loader(evt.currentTarget);
img.alpha += (1 - img.alpha)/12;
}
function onOver(evt:MouseEvent):void {
evt.currentTarget.scaleX = evt.currentTarget.scaleY = 2;
}
//
function onOut(evt:MouseEvent):void {
evt.currentTarget.scaleX = evt.currentTarget.scaleY = .5;
}
I tried to add the following line of code on OnOver as I saw it in another thread, but it gives me an error message:
this.setChildIndex(this.getChildByName(evt.currentTarget.name), this.numChildren-1);
Can somebody be so kind to help me.