reprendre avec MovieClipLoader

reprendre avec MovieClipLoader - Flash/ActionScript - Programmation

Marsh Posté le 30-03-2006 à 00:17:50    

:) Salut !!
 
J’aimerais reprendre ce code et le mettre à jour (je débute un peu )
J’aimerais savoir ce qui devient inutile dans ce code  si j’utilise un  "MovieClipLoader"
 
Merci !!

Code :
  1. var Nbr;
  2. var curLength;
  3. function galleryChoice(q) {
  4. pArray = new Array();
  5. tArray = new Array();
  6. iArray = new Array();
  7. my_xml = new XML();
  8. for (var j = 0; j<curLength; j++) {
  9.  this["thmb"+j].removeMovieClip();
  10. }
  11. my_xml.ignoreWhite = true;
  12. my_xml.onLoad = function(loaded) {
  13.  if (loaded) {
  14.   gallery = this.firstChild.childNodes[q];
  15.   curLength = gallery.childNodes.length;
  16.   for (var i = 0; i<gallery.childNodes.length; i++) {
  17.    pArray.push(gallery.childNodes[i].attributes.source);
  18.    tArray.push(gallery.childNodes[i].attributes.thumb);
  19.    iArray.push(gallery.childNodes[i].attributes.title);
  20.   }
  21.  }
  22.  delay = setInterval(makeButtons, 50);
  23. };
  24. my_xml.load("gallery.xml" );
  25. }
  26. //*********************************************************************
  27. function makeButtons() {
  28. Nbr = 0;
  29. clearInterval(delay);
  30. for (var i = 0; i<tArray.length; i++) {
  31.  var Mc_clip = thmb.duplicateMovieClip("thmb"+i, 1000+i);
  32.  Mc_clip.id = i;
  33.  Mc_clip._x = i%3*50;
  34.  Mc_clip._y = Math.floor(i/3)*50;
  35. }
  36. loadButtons();
  37. }
  38. //*********************************************************************
  39. function loadButtons() {
  40. var tbox = this["thmb"+Nbr].box;
  41. tbox.loadMovie(tArray[Nbr]);
  42. temp = this.createEmptyMovieClip("tmp"+Nbr, 999);
  43. temp.onEnterFrame = function() {
  44.  bt = tbox.getBytesTotal();
  45.  bl = tbox.getBytesLoaded();
  46.  if (bt == bl && bt>4) {
  47.   nextButton();
  48.   delete this.onEnterFrame;
  49.  }
  50. };
  51. }
  52. //*********************************************************************
  53. function nextButton() {
  54. if (Nbr<tArray.length-1) {
  55.  Nbr++;
  56.  loadButtons();
  57. } else {
  58.  activateButtons();
  59. }
  60. }
  61. //tous les boutons*********************************************************************
  62. function activateButtons() {
  63. mainButtons();
  64. for (var i = 0; i<pArray.length; i++) {
  65.  var but = this["thmb"+i];
  66.  but.id = i;
  67.  but.onRelease = function() {
  68.  };
  69. }
  70. }
  71. //*********************************************************************
  72. butArray = new Array();
  73. butArray = ["gal1_btn", "gal2_btn", "gal3_btn", "gal4_btn"];
  74. function mainButtons() {
  75. for (var i = 0; i<butArray.length; i++) {
  76.  this[butArray[i]].id = i;
  77.  this[butArray[i]].onRelease = function() {
  78.   galleryChoice(this.id);
  79.  };
  80. }
  81. }
  82. //*********************************************************************
  83. galleryChoice(0);


Reply

Marsh Posté le 30-03-2006 à 00:17:50   

Reply

Marsh Posté le 30-03-2006 à 08:09:41    

[:sh@rdar]  

Citation :


var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("YourImage.jpg", container);


source:http://livedocs.macromedia.com/flash/8_fr/main/00002541.html
en gros:
tbox.loadMovie(tArray[Nbr]); == mcLoader.loadMovie(tArray[Nbr], tbox);


---------------
D3
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed