Flash tester si fichier existe en cascade...

Fermé
MAMu_ Messages postés 48 Date d'inscription mercredi 3 avril 2013 Statut Membre Dernière intervention 25 mai 2013 - 25 avril 2013 à 13:05
Bonjour, dans mon projet Flash (AS2) je precharge une image externe, puis l'affiche (prechargement requis pour smoother mon image) avec le code suivant, ce code est lui-même dans un clip sur la premiere frame, dans lequel sur la premiere image se trouve le clip "myphoto" dans lequel je viens inserer mon image... :

import flash.display.*; 

function loadBitmapSmoothed(url:String, target:MovieClip) { 
// Create a movie clip which will contain our unsmoothed bitmap 
var bmc:MovieClip = target.createEmptyMovieClip("bmc", target.getNextHighestDepth()); 

// Create a listener which will notify us when the bitmap loaded successfully 
var listener:Object = new Object(); 

// Track the target 
listener.tmc = target; 

// If the bitmap loaded successfully we redraw the movie into a BitmapData object and then attach 
// that BitmapData to the target movie clip with the smoothing flag turned on. 
listener.onLoadInit = function(mc:MovieClip) { 
mc._visible = false; 

var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true); 

this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(),"auto",true); 
bitmap.draw(mc); 
}; 

// Do it, load the bitmap now 
var loader:MovieClipLoader = new MovieClipLoader(); 
loader.addListener(listener); 
loader.loadClip(url, bmc); 
} 

//choose file to show and add it to "myphoto" 
var imagetoshow="snap/"+_level0.shortname+".png";
//trace (imagetoshow);
loadBitmapSmoothed(imagetoshow,myphoto);


Tout marche parfaitement si mon image 'imagetoshow' est trouvée...

Mon problème est que si l'image n'est pas trouvée, comment tester l'existence d'une autre image, l'afficher en place si trouvée, et si cette seconde n'est pas trouvée, en afficher une par defaut...

Une idée de comment procéder...?