1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
import mx.services.*;
var wsdlURI = "http://www.monsite.fr/web-services/monwsdl.wsdl";
// create the service
monService = new WebService(wsdlURI);
// Handle the WSDL loading event.
monService.onLoad = function(wsdl)
{ trace("--- onLoad");
callphotos();
trace("--- end onLoad");
};
// si le chargement du WSDL echou l'evenement onFault est declanché.
monService.onFault = function(fault)
{ trace("--- rateService onFault");
trace( fault.faultstring );
trace("--- end rateService onFault");
};
function callphotos()
{ var
callback:PendingCall
callback = monService.searchphotos();
// Handle a successful result. This is the important bit :-)
callback.onResult = function(result)
{ trace("--- Result");
createGalerie(result);
trace("--- end Result");
};
// Handle an error result.
callback.onFault = function(fault)
{ trace("--- callback onFault");
trace( fault.faultstring );
trace("--- end callback onFault");
}
}
//Création de la galerie
function createGalerie(noeuds) //liste des images
{ //On parcours la liste
for (var i = 0; i<noeuds.length; i++)
{ //nom de l'image
var nom = noeuds[i].NOMFIC;
//On crée un clip vide et le positionne
var img = this.createEmptyMovieClip("img"+i, i);
img._x = (i%5)*55+400;
//On charge la miniature
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip)
{ trace("--- mclListener onLoadInit");
target_mc._height = 50;
target_mc._width = 50;
trace(target_mc._parent._name);
trace("--- end mclListener onLoadInit");
};
var
view:MovieClip = img.createEmptyMovieClip("view", getNextHighestDepth());
var
mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(mclListener);
mcLoader.loadClip("thumb/"+nom, view);
img.onRelease = function()
{ popup(this.nom, this.width, this.height); };
}
}
//Lance une popup
function popup(url, width, height)
{ var lalargeur = Math.min(Number(width)+20, System.capabilities.screenResolutionX);
var lahauteur = Math.min(Number(height)+20, System.capabilities.screenResolutionY);
var t = (System.capabilities.screenResolutionY-lahauteur)/2;
var l = (System.capabilities.screenResolutionX-lalargeur)/2;
var propriete = "width="+lalargeur+",height="+lahauteur+",top="+t+",left="+l;
if (lalargeur == System.capabilities.screenResolutionX || lahauteur == System.capabilities.screenResolutionY)
{ propriete += ",scrollbars=1"; }
getURL("javascript:void(window.open('"+url+"','image"+width+"','"+propriete+"'));");
} |
Partager