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
| var img_xml:XML = new XML();
img_xml.ignoreWhite = true;
img_xml.onLoad = LoadStar;
img_xml.load("images.xml");
/*variable thumbs*/
var thumbs_x:Number = 5;
var thumbs_y:Number = 5;
var thumbs_space:Number = 5;
var thumbs_clips:Array = new Array();
/*mask*/
this.createEmptyMovieClip("thumbs", 1);
/*fonction parse xml*/
function LoadImage() {
racine = this.firstChild;
/*nombre de thumbs*/
img_number = this.firstChild.childNodes.length;
for (i=0; i < img_number; i++) {
img = racine.childNodes[i];
img_id = star.childNodes[0].firstChild.nodeValue;
img_img_tn = star.childNodes[1].firstChild.nodeValue;
/*création des clips*/
thumbs_clips[i] = thumbs.createEmptyMovieClip("mc" + i, i);
/*loading des images*/
thumbs_clips[i].createEmptyMovieClip("img", 1);
var img_mcl:MovieClipLoader = new MovieClipLoader();
img_mcl.addListener(mclListener);
img_mcl.loadClip(img_img_tn, thumbs_clips[i].img);
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
var img_tn_width:Number = target_mc._width;
};
/*positionnement*/
thumbs_clips[i]._y = thumbs_y;
thumbs_clips[i]._x = i * (img_tn_width + thumbs_space) + thumbs_x;
};
}; |
Partager