Hi many thanks, will check this out in a sec, just having a full english
breakfast, yes managed to do the product zoomer with a lot of help from
'Cor' on here. it works really well, and i've made it kind of dynmaic so you
can select different angles to zoom, you are quite welcome to the fla is you
want,

thanks, Thomas

-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Keith
Reinfeld
Sent: 19 September 2009 07:52
To: 'Flash Coders List'
Subject: RE: [Flashcoders] trouble with adding/removing multiple preloaders
on thumbs

Thomas, 

I think the example code below addresses your primary concerns. The biggest
changes involve using a loaderArray to prevent overwriting previous Loader()
assignments, and also using getChildByName() to grab the relevant preloader
instance for removal. See inline comments. Let me know if you have any
questions. 
So, did you work out your image panning interaction? 

Code: 

import gs.TweenLite; 

var myXML:XML = <pics> 
                        <IMAGE SMALL="images/pic1.jpg"/> 
                        <IMAGE SMALL="images/pic2.jpg"/> 
                        <IMAGE SMALL="images/pic3.jpg"/> 
                        <IMAGE SMALL="images/pic4.jpg"/> 
                        <IMAGE SMALL="images/pic5.jpg"/> 
                        </pics>; 
 
 
var container1:MovieClip = new MovieClip(); 
var loaderArray:Array = []; 
addChild(container1); 
var my_images:XMLList = myXML.IMAGE; 
var my_total:Number = my_images.length();  
 
callThumbs(); 
 
function callThumbs():void { 
        for (var s:Number = 0; s < my_total; s++) { 
                var thumb_url:String = my_images[...@small; 
                // Store each Loader separately as an array element 
                // so it won't be overwritten by the next. - KR 
                loaderArray[s] = new Loader(); 
                loaderArray[s].load(new URLRequest(thumb_url)); 
        
loaderArray[s].contentLoaderInfo.addEventListener(Event.COMPLETE,thumbLoaded
);  
                var preloader:starPreloader = new starPreloader();  
                // Name the preloader instance after the current url's 
                // filename so we can pick-up on it later. - KR 
                preloader.name =
thumb_url.substr(thumb_url.lastIndexOf("/")+1); 
                loaderArray[s].y = 105 * s; 
                // I am not putting the preloader 'in' the thumbnail, 
                // just overlaying it. - KR 
                preloader.y = 105 * s; 
                //add preloader to the container 
                container1.addChild(preloader); 
                container1.buttonMode = true; 
                // The next two lines caused reference errors for me - KR 
                //zoom.small.addChild(container1); 
                //container1.addEventListener(MouseEvent.CLICK, callFull); 
        } 
} 
 
function thumbLoaded(e:Event):void { 
        var my_thumb:Loader=Loader(e.target.loader); 
        // Display the thumbnail image behind the preloader. - KR 
        container1.addChildAt(my_thumb,0); 
        // Here is where we identify the preloader that 
        // corresponds with the current thumbnail image. - KR 
        var currentURL:String = e.currentTarget.url; 
        var preloaderName:String =
currentURL.substr(currentURL.lastIndexOf("/")+1); 
        trace("\npreloaderName =",preloaderName); 
        var preloader:starPreloader =
container1.getChildByName(preloaderName) as starPreloader; 
        TweenLite.to(preloader, 1, {scaleX: 0, scaleY: 0, alpha: 0,
onComplete:thumbFinished, onCompleteParams:[container1, preloader]}); 
} 
 
function thumbFinished(mc:MovieClip, mc2:starPreloader):void { 
        trace("\nthumbFinished() called",mc.name,mc2.name); 
        //Remove the preloader 
        mc.removeChild(mc2); 
} 


Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to