1 Reply Latest reply on Oct 6, 2009 4:32 AM by Sreelash

    Doubs regarding slideshow

    Sreelash

      Hi,

       

           I am trying to implement a slideshow with the help of a tutorial. As the first step, i tried to load two Images. But the image is not getting loaded. The following code is used for image loading purpose:

       

      stop();

       

      import mx.transitions.*;
      import mx.transitions.easing.*;

       

      var picArray:Array = new Array(); //array to hold the image and all of its attributes
      var thisNode:XMLNode = new XMLNode();
      //var imagePath:String = new String();

       

      var pic1:MovieClip = slide1;
      var pic2:MovieClip = slide2;
      var currClip:MovieClip = pic1; //tracks which clip is being viewed
      var arrPosition:Number = -1; //tracks where the code is in the picture array
      var showpicTime:Number = 7; //number of seconds to display the pic between fades
      var tweenTime:Number = 3; //number of seconds to complete tween
      var initialImage:Boolean = true; //used in onLoadInit for first image

       

      var imageXML:XML = new XML();
      imageXML.ignoreWhite = true;
      imageXML.onLoad = function(success:Boolean) {
          for(var i:Number = 0;i<imageXML.firstChild.childNodes.length;i++) {
              thisNode = imageXML.firstChild.childNodes[i];
              picArray.push(thisNode.firstChild);
          }
          //When the xml is completely loaded,
          //delete the xml (since its now contained in picArray)
          //and continue to the slideshow
          delete imageXML;
          //play();
          loadInitialImage(picArray)
      }
      imageXML.load("slides.xml");

       

      pic1.picLoaded = false;
      pic2.picLoaded = false;

       

      pic1._alpha = pic2._alpha = 0;

       

      function loadInitialImage(picArray){
          var mcLoader:MovieClipLoader = new MovieClipLoader();
          var mcListener:Object = new Object();
          mcLoader.addListener(mcListener);
          mcListener.onLoadInit = function(mc:MovieClip) {
              trace(mc)
              mc._parent.picLoaded = true;    
              if (initialImage) {
                  initialImage = false;
                  var firstTween = new Tween(pic1, "_alpha", Regular.easeIn, 1, 100 , tweenTime, true);
                  //picInt = setInterval(crossfade,showpicTime*1000);
              };
          };           
          mcLoader.loadClip(picArray[++arrPosition],pic1);
          mcLoader.loadClip(picArray[++arrPosition],pic2);
      }

       

      Can anybody help mw to solve this issue.

       

      Thanks and Regards,

                              Sreelash