0 Replies Latest reply on Jul 8, 2010 5:33 AM by FlashLeaner

    How to make xml slideshow more advance

    FlashLeaner

      I just completed my slideshow using one of the tutorial finding in google i want to make this slideshow more advance like next slide show will stop until next image is loaded (means won't play is second image is not loaded and only plays when the second image is loaded) . I use these actionscript code.

       

       

       

      import mx.transitions.Tween;

      import mx.transitions.easing.*;

      import mx.xpath.XPathAPI;

       

      var delay:Number;

      var animationDuration:Number;

      var current_num:Number = 0;

      var first_num:Number = 0;

      var image_holder:MovieClip = container1_mc.createEmptyMovieClip("image_holder", container1_mc.getNextHighestDepth());

      var mcl_lis:Object = new Object();

      var mcl:MovieClipLoader = new MovieClipLoader();

      mcl.addListener(mcl_lis);

      var xml:XML = new XML();

      xml.ignoreWhite = true;

      xml.onLoad = function( isLoaded:Boolean )

      {

      if( isLoaded )

      {

      data_arr = XPathAPI.selectNodeList(this.firstChild,"Slideshow/images/image");

      delay = parseInt(XPathAPI.selectSingleNode(this.firstChild,"Slideshow/settings/delay").firstChild );

      animationDuration = parseInt(XPathAPI.selectSingleNode(this.firstChild,"Slideshow/settings/animationDuration" ).firstChild);

      //optional code to check delay and animationDuration values

      (delay == undefined || delay == null) ? delay = 5000: delay<1000? delay =1000:true;

      (animationDuration == undefined || animationDuration == null) ? animationDuration = .8: animationDuration<.3? animationDuration =.8:true;

      load_image();

      }else

      {

      trace("XML Load error");

      }

      }

      xml.load("data.xml")

       

      function load_image()

      {

      mcl.loadClip(data_arr[current_num].attributes.url, image_holder);

      (current_num>=data_arr.length-1) ? current_num = first_num:current_num++;

      }

       

      mcl_lis.onLoadInit = function(target_mc:MovieClip) {

      var obj:Tween = new Tween(target_mc, "_alpha", Normal.easeIn, 0, 100, .5, true);

      setTimeout(function(){

      var obj:Tween = new Tween(target_mc, "_alpha", Elastic.easeIn, 100, 10, 0.1, true);

      obj.onMotionFinished = function() {load_image();};

      },5000);

      };

       

       

      //////Button Click Action starts/////////////

       

      learnMore_btn.onRelease = function(){

      getURL("http://google.com","_self");

      }

       

      Thanks