0 Replies Latest reply on May 8, 2006 3:15 PM by rkrak

    Categorical Auto Picture Viewer

    rkrak
      hello i have a catagorical picture viewer that works, but i would like it to play the pictures without any user interaction after they pick which cateory they want to watch. I have four buttons on the app currenlty and those work, but i cannot get each category to automatically load each pictures with about a 4 second pause between each one. here is the code for this application which was bassically taken out of a DMX Zone tutorial:
      If someone knows what i would need to change in this code to make this work i would appreicate it. Thanks for your time.
      var PhotoXML:XML = new XML();
      var PhotoNumber:Number;
      var TotalPhotos:Number;
      var RootNode:XMLNode;
      var SelectedCategory:String;

      loadPhotoXML("catPhotos2006.xml");

      function loadPhotoXML(filename:String):Void {
      PhotoXML.ignoreWhite = true;
      PhotoXML.load(filename);
      PhotoXML.onLoad = function (success:Boolean):Void {
      if (success) {
      RootNode = this.firstChild;
      FastForward_btn.enabled = false;
      Next_btn.enabled = false;
      Previous_btn.enabled = false;
      Rewind_btn.enabled = false;
      loadCombo();
      }
      };
      }

      function showPhoto(CategoryName:String, PhotoNum:Number):Void {
      for (var i:Number =0; i < RootNode.childNodes.length; i++){
      if (RootNode.childNodes .attributes.name == CategoryName) {
      var CategoryXML:XMLNode = RootNode.childNodes
      ;
      TotalPhotos = CategoryXML.childNodes.length;
      }
      }
      if (PhotoNum == TotalPhotos -1) {
      FastForward_btn.enabled = false;
      Next_btn.enabled = false;
      }
      else {
      FastForward_btn.enabled = true;
      Next_btn.enabled = true;
      }

      if (PhotoNum == 0) {
      Previous_btn.enabled = false;
      Rewind_btn.enabled = false;
      }
      else {
      Previous_btn.enabled = true;
      Rewind_btn.enabled = true;
      }
      var PhotoURL:String = CategoryXML.childNodes[PhotoNum].attributes.jpegURL;
      var PhotoCaption:String = CategoryXML.childNodes[PhotoNum].firstChild.nodeValue;
      empty_mc.loadMovie("photos/" + PhotoURL);
      caption_txt.text = PhotoCaption;
      }

      function loadCombo():Void {
      Gallery_cbo.addItem("-- Select Photo Album --");
      for (var i:Number =0; i < RootNode.childNodes.length; i++){
      Gallery_cbo.addItem(RootNode.childNodes .attributes.name);
      play();
      }
      var comboListener bject = new Object();
      comboListener.change = function(evt):Void {
      if (evt.target.selectedItem.label != "-- Select Photo Album --") {
      PhotoNumber = 0;
      SelectedCategory = evt.target.selectedItem.label;
      showPhoto(SelectedCategory, PhotoNumber);
      }
      else {
      empty_mc.unloadMovie();
      caption_txt.text = "";
      FastForward_btn.enabled = false;
      Next_btn.enabled = false;
      Previous_btn.enabled = false;
      Rewind_btn.enabled = false;
      }
      };
      Gallery_cbo.addEventListener("change", comboListener);
      }