olimann | Salut !!
Jaimerais reprendre ce code et le mettre à jour (je débute un peu )
Jaimerais savoir ce qui devient inutile dans ce code si jutilise un "MovieClipLoader"
Merci !!
Code :
- var Nbr;
- var curLength;
- function galleryChoice(q) {
- pArray = new Array();
- tArray = new Array();
- iArray = new Array();
- my_xml = new XML();
- for (var j = 0; j<curLength; j++) {
- this["thmb"+j].removeMovieClip();
- }
- my_xml.ignoreWhite = true;
- my_xml.onLoad = function(loaded) {
- if (loaded) {
- gallery = this.firstChild.childNodes[q];
- curLength = gallery.childNodes.length;
- for (var i = 0; i<gallery.childNodes.length; i++) {
- pArray.push(gallery.childNodes[i].attributes.source);
- tArray.push(gallery.childNodes[i].attributes.thumb);
- iArray.push(gallery.childNodes[i].attributes.title);
- }
- }
- delay = setInterval(makeButtons, 50);
- };
- my_xml.load("gallery.xml" );
- }
- //*********************************************************************
- function makeButtons() {
- Nbr = 0;
- clearInterval(delay);
- for (var i = 0; i<tArray.length; i++) {
- var Mc_clip = thmb.duplicateMovieClip("thmb"+i, 1000+i);
- Mc_clip.id = i;
- Mc_clip._x = i%3*50;
- Mc_clip._y = Math.floor(i/3)*50;
- }
- loadButtons();
- }
- //*********************************************************************
- function loadButtons() {
- var tbox = this["thmb"+Nbr].box;
- tbox.loadMovie(tArray[Nbr]);
- temp = this.createEmptyMovieClip("tmp"+Nbr, 999);
- temp.onEnterFrame = function() {
- bt = tbox.getBytesTotal();
- bl = tbox.getBytesLoaded();
- if (bt == bl && bt>4) {
- nextButton();
- delete this.onEnterFrame;
- }
- };
- }
- //*********************************************************************
- function nextButton() {
- if (Nbr<tArray.length-1) {
- Nbr++;
- loadButtons();
- } else {
- activateButtons();
- }
- }
- //tous les boutons*********************************************************************
- function activateButtons() {
- mainButtons();
- for (var i = 0; i<pArray.length; i++) {
- var but = this["thmb"+i];
- but.id = i;
- but.onRelease = function() {
- };
- }
- }
- //*********************************************************************
- butArray = new Array();
- butArray = ["gal1_btn", "gal2_btn", "gal3_btn", "gal4_btn"];
- function mainButtons() {
- for (var i = 0; i<butArray.length; i++) {
- this[butArray[i]].id = i;
- this[butArray[i]].onRelease = function() {
- galleryChoice(this.id);
- };
- }
- }
- //*********************************************************************
- galleryChoice(0);
|
|