Bonjour,
J'ai fait une banniere qui recupere, via un fichier xml, des images avec des liens dessus
Toutefois, le redimensionnement des images me pose probleme car elles n'ont pas toutes la même taille
Pouvez vous m'aider ?
Voici le code
[b]_root.startMoves=true;
var my_xml = new XML();
my_xml.ignoreWhite = true;
ycheck = false;
my_xml.onLoad = function(success){
if (success){
//createEmptyMovieClip("mcScroller", getNextHighestDepth());
for (var i=0; i<my_xml.firstChild.childNodes.length; i++){
image = my_xml.firstChild.childNodes[i].attributes.img_url;
//trace (image);
var loadListener:Object = new Object();
var container:MovieClip = mcScroller.createEmptyMovieClip("container"+i, getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
mcLoader.loadClip(image, container);
loadListener.onLoadInit = function () {
_root.forceSmoothing = true;
}
container._x = 45*i+17;
if (ycheck) {
container._y = 43;
ycheck = false;
} else {
container._y = 30;
ycheck = true;
}
container._xscale = 11;
container._yscale = 11;
var btnName = ""+[i];
_root.attachMovie("but_t", btnName, getNextHighestDepth());
_root[btnName]._x = container._x;
_root[btnName]._y = container._y;
_root[btnName].onRelease = function () {
getURL(my_xml.firstChild.childNodes[this._name].attributes.destination_url,"_blank");
//trace (my_xml.firstChild.childNodes[this._name].attributes.destination_url);
};
_root[btnName].onRollOver = function () {
_root.mcScroller["container"+this._name]._xscale = 18;
_root.mcScroller["container"+this._name]._yscale = 18;
//tempDepth = _root["container"+this._name].getDepth();
_root.mcScroller["container"+this._name].swapDepths (_root["container"+my_xml.firstChild.childNodes.length]);
};
_root[btnName].onRollOut = function () {
_root.mcScroller["container"+this._name]._xscale = 11;
_root.mcScroller["container"+this._name]._yscale = 11;
};
}
}
}
my_xml.load("magasines.xml");
/b
Matol
Afficher la suite