Type Coercion failed when accessing custom Class

Hello ppl.

I’m trying to make my own picture browser for my webpage, and have run into a problem I can’t solve. My guess is that this is kinda a newbie-problem, but anyway here I go… :thumb:

I have made a class (as an extention to MovieClip) in a seperate file where I can load a picture and later resize it into a thumbnail. I have no problem showing them, but when I tried to make a MouseEvent for clicking onto the shown thumbnail and then tries to access the instance the event sends me, I get :

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Loader@22c30791 to ThumbNail.
at PicBrowser_fla::MainTimeline/clickedOnThumbNail()

I don’t understand why it complains on ‘Loader’!?
And what is the best way to access the instance of the ‘ThumbNail’ in the MouseEvent?

**The .as file looks something like this : **

package 
{
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;
    import flash.net.*;
    
    public class ThumbNail extends MovieClip
    {
        public var strFileName:String = "";
    
        public function ThumbNail()
        {
        }
        
        public function loadPicture(fileName:String) {
            strFileName = fileName;
            loading_txt.text = "Loading : " + strFileName;
            
            var imgLoader:Loader = new Loader();
            imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
            imgLoader.load(new URLRequest(fileName));
        }
        
        function loadComplete(e:Event) {
            var imageLoader:Loader = Loader(e.target.loader);
        
            //Scaling picture into a 60x60 image
            imageLoader.scaleX = 1 / (imageLoader.width / 60);
            imageLoader.scaleY = 1 / (imageLoader.height / 60);
            
            thumb_mc.addChild(imageLoader);
        }
        
        public function getFileName():String {
            return strFileName;
        }
    }
}

and the actionscript in my main file :

var imageArray:Array = new Array("Jag.jpg", "Eye.jpg", "Peo.jpg");

for(var i:Number = 0; i < imageArray.length; i++) {
    var newThumbNail:ThumbNail = new ThumbNail();
    newThumbNail.loadPicture(imageArray*);
    this.addChild(newThumbNail);
    newThumbNail.x = 70*i + 10;
    newThumbNail.y = 10;
    
    newThumbNail.addEventListener(MouseEvent.CLICK, clickedOnThumbNail);
}

function clickedOnThumbNail(e:MouseEvent) 
{
    var nail:ThumbNail = ThumbNail(e.target);
}

Any ideas??