Hey mac, 

Bob Leisle makes a good point: I don't understand what kind of link you are
hoping to pass to getURL(). For the sake of my example code (see below) I
have simply reused the image urls you have provided. 

Additionally I would suggest that you avoid using '_root'. Use the 'this'
keyword instead. 

Please be sure to read the comments inserted into the code below: 

<code> 
var arrURLs:Array =
["http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/perilendhouse/perilendhouse
-100.gif", 
        
"http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/sallyssalon/sallyssalon-100.
gif", 
        
"http://l.yimg.com/us.yimg.com/i/us/ga/gameart2/riseofatlantis/riseofatlanti
s-100.gif"]; 
 
// use arrIDs array to store the id return values from setInterval calls 
var arrIDs:Array = []; 
var thumbHorizontalGap = 110; 
for (var i:Number = 0; i < 3; i++) { 
        var url:String = arrURLs[i]; 
        var vidThumb:MovieClip = this.createEmptyMovieClip("vThumb" + i, i +
1000); 
        vidThumb._y = i * thumbHorizontalGap; 
        vidThumb.loadMovie(url); 
        // if you assign the following properties now 
        // they will only be destroyed by loadMovie()
        //vidThumb.link = url; 
        //vidThumb.onRelease = openURL; 
        // assign properties only after loadMovie() is complete 
        clearInterval(arrIDs[i]);
        arrIDs[i] = setInterval(confirmLoaded, 100, vidThumb, url, i); 
} 
 
function openURL() { 
        trace("\nthis = " + this); 
        trace("this.link = " + this.link); 
        getURL(this.link); 
} 
// call confirmLoaded repeatedly with setInterval 
// until the file has completely loaded 
// then clear the interval id and assign the link and button properties
function confirmLoaded(mc:MovieClip, link:String, id:Number){ 
        trace("\nconfirmLoaded("+mc+", "+link+", "+arrIDs[id]+") called"); 
        pct = mc.getBytesLoaded()/mc.getBytesTotal()*100; 
        if(!isNaN(pct) && pct>=100 && mc._width>0){ 
                clearInterval(arrIDs[id]);
                mc.link = link; 
                mc.onRelease = openURL; 
        } 
} 
</code> 
 
HTH 
 
 
Regards, 

-Keith 
http://keithreinfeld.home.comcast.net
 


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

Reply via email to