addChild-Selected Child Always On Top

Hey all,

I have a package that scales a pic up when the pic is moused over. Also in the .fla that references that package, I have code that loads the pics into movie clips on the stage(using XML).

My problem is that when I mouse over the pic it goes behind the other pics that are next to it. The moused over pic needs to appear above the surrounding pics. I know this is an addChildAt / indexing issue. I’m just having trouble working it into my code.

Actually, the package code (PhotoScaler.as) has a line that is supposed to make the moused over mc go above everything else, but it doesn’t work when I add a pic to the symbol

Here is the Package code:

package AS3code { 
	
	import caurina.transitions.Tweener
	import flash.display.MovieClip;
        import flash.events.MouseEvent;
	
    public class PhotoScaler {
        private var _clip:MovieClip;
		
        public function PhotoScaler(clip:MovieClip) {
            _clip = clip;
            _clip.addEventListener(MouseEvent.MOUSE_OVER, scalePicUp);
            _clip.stage.addEventListener(MouseEvent.MOUSE_OUT, scalePicNormal);
	    _clip.parent.setChildIndex(_clip, _clip.parent.numChildren - 1);//this insures that movie clip will always be on top of other elements

        }
		
        private function scalePicUp(event:MouseEvent) {
			Tweener.addTween(_clip, {scaleX:2, scaleY:2, alpha:1, time:1.5, delay:0, transition:"easeOutExpo"});   
		}
		
        private function scalePicNormal(event:MouseEvent) {
			Tweener.addTween(_clip, {scaleX:1, scaleY:1, alpha:1, time:0.5, delay:0, transition:"easeInOutExpo"});  
        }
    }
}

the above code is imported by using the import command
and associated variables on the first frame of the main movie as follows:

import AS3code.PhotoScaler; 

//The following refrences PhotoScaler.as////
var myPhotoScaler:PhotoScaler = new PhotoScaler(bioPhotoGrid.pic1); //the var name here can be anything
var myPhotoScaler2:PhotoScaler = new PhotoScaler(bioPhotoGrid.pic2);
var myPhotoScaler3:PhotoScaler = new PhotoScaler(bioPhotoGrid.pic3);
var myPhotoScaler4:PhotoScaler = new PhotoScaler(bioPhotoGrid.pic4);
var myPhotoScaler5:PhotoScaler = new PhotoScaler(bioPhotoGrid.pic5); 
var myPhotoScaler6:PhotoScaler = new PhotoScaler(bioPhotoGrid.pic6);
var myPhotoScaler7:PhotoScaler = new PhotoScaler(bioPhotoGrid.pic7);
var myPhotoScaler8:PhotoScaler = new PhotoScaler(bioPhotoGrid.pic8);
/////// End Reference to PhotoScaler.as//////////////////////////////////

Here is my code that loads the pics:

//Picture loader////////////////////////////
var xmlPicLoader:URLLoader = new URLLoader();
var xmlPicData:XML = new XML();
xmlPicLoader.addEventListener(Event.COMPLETE, LoadPicXML); 
xmlPicLoader.load(new URLRequest("testPhotoLoader.xml"));
 

function LoadPicXML(e:Event):void {
	xmlPicData = new XML(e.target.data);
	Parseimages(xmlPicData);
}

function Parseimages(imageInput:XML):void {
    //trace(imageInput.PIC);
	
    var myPicLoader = new Loader;
    var myPicLoader2 = new Loader;

    var pictureURL:URLRequest = new URLRequest(imageInput.PIC);
    var pictureURL2:URLRequest = new URLRequest(imageInput.PIC2);
	
    myPicLoader.load(pictureURL);
    myPicLoader2.load(pictureURL2);

    bioPhotoGrid.pic1.addChild(myPicLoader); //here, a movie clip instance is placed before addChild to hold pic
	bioPhotoGrid.pic2.addChild(myPicLoader2);

}

Any help would be appreciated. By the way, you may be wondering why I’m not putting all my code into the Package. It’s because i’m completely new to packages and have not converted all my code yet…

Thank you
-D