0 Replies Latest reply on Oct 15, 2007 2:29 AM by Seise

    Slideshow with caption

    Seise
      Hello...

      I´ve done a slideshow with flash and xml. In the xml file there are this:

      <slideshow>
      <pic url="my pic.jpg" caption="the text I want to show" />
      </slideshow>

      I have 3 pics right now but where do I put the code in the fla? I tried to put it in different places but then all 3 pictures have the saame text.. The code in fla is:

      import mx.transitions.Tween;
      import mx.transitions.easing.Strong;

      this.createEmptyMovieClip("container2_mc",this.getNextHighestDepth());
      this.createEmptyMovieClip("container1_mc",this.getNextHighestDepth());
      this.createEmptyMovieClip("buttons_mc",this.getNextHighestDepth());
      this.attachMovie("loader","loader_mc",this.getNextHighestDepth());
      loader_mc._x = 547.6;
      loader_mc._y = 366.4;

      container1_mc._x = 356;
      container1_mc._y = 94;
      container2_mc._x = 356;
      container2_mc._y = 94;

      var myMCL:MovieClipLoader = new MovieClipLoader();
      var myListener:Object = new Object();
      myMCL.addListener(myListener);


      myListener.onLoadProgress = function(target,bytesLoaded,bytesTotal){
      loader_mc._alpha = 100;
      var pct = Math.round(bytesLoaded/bytesTotal*100);
      loader_mc.bar_mc._xscale = pct;
      }

      myListener.onLoadComplete = function(target){
      loader_mc._alpha = 0;
      fadeIn();
      }



      buttons_mc.attachMovie("prev","prev_mc",buttons_mc.getNextHighestDepth());
      buttons_mc.attachMovie("next","next_mc",buttons_mc.getNextHighestDepth());


      buttons_mc.next_mc._x = 960 - buttons_mc.next_mc._width - 45;
      buttons_mc.next_mc._y = 475;
      buttons_mc.prev_mc._x = 340;
      buttons_mc.prev_mc._y = 475;

      //-------------XML--------------------------//
      var myXML:XML = new XML();
      myXML.ignoreWhite = true;

      var picArray:Array = new Array();
      var captions:Array = new Array();

      var currentElement:Number = 0;


      myXML.onLoad = function(success){
      if(success){
      var ss:Array = myXML.firstChild.childNodes;
      for(i=0;i<ss.length;i++){
      picArray.push(ss .attributes.url);
      captions.push(ss
      .attributes.caption);
      }
      init();

      }
      else
      {
      trace("XML could not load");
      }

      }
      myXML.load("test.xml");
      var currentContainer:MovieClip = container1_mc;


      function init(){

      myMCL.loadClip(picArray[currentElement],container1_mc);

      }

      buttons_mc.next_mc.onRelease = function(){
      if (currentContainer == container1_mc){
      currentContainer = container2_mc;
      }
      else
      {
      currentContainer = container1_mc;
      }
      currentContainer._alpha =0;
      container1_mc.swapDepths(container2_mc);
      if(currentElement < picArray.length -1){
      currentElement ++;
      }
      else
      {
      currentElement = 0;
      }
      myMCL.loadClip(picArray[currentElement],currentContainer);

      }


      buttons_mc.prev_mc.onRelease = function(){
      if (currentContainer == container2_mc){
      currentContainer = container1_mc;
      }
      else
      {
      currentContainer = container2_mc;

      }
      currentContainer._alpha =0;
      container2_mc.swapDepths(container1_mc);
      if(currentElement > 0){
      currentElement --;

      }
      else
      {
      currentElement = picArray.length -1;

      }
      myMCL.loadClip(picArray[currentElement],currentContainer);

      }

      function fadeIn(){
      new Tween(currentContainer,"_alpha",Strong.easeOut,0,100,36,false);
      }

      Do any one know where to put the caption.text=captions[0];