2 Replies Latest reply on Mar 29, 2008 11:54 AM by rebeccae

    action script2

    rebeccae Level 1

      our program www.marie.apioneerphoto.com is working. I would like to add an automatic dynamic slide show but am not sure how to do it.

      In my code I have a working function that calls for the next image to be displayed - loadNextImage() (it automaticaly resets itself if it comes to the last photo it then starts at the beginning)
      Before each photo has to be started it needs a click or a user intervention. Real pain when you want to view 500 or so.

      My dream ...
      I would like to use Key.DOWN to start the show and Key.UP to abort the show.

      my code is ...


      myobject=new Object();
      Key.addListener(myobject);
      myobject.onKeyDown=function<>{
      if (Key.isDown(Key.DOWN)){
      loadNextImage();
      // need to setup a time span and then call for the next image - have it loop continually
      }
      if (Key.isDown(Key.UP)){
      // need to stop the loop that we started with Key.Down which will stop the automatic play
      }}

      This sounds so simple but to me, I am staring at a wall stopped in my tracks - can you please help?
        • 1. action script2
          makisiege
          i dont how to help you but i can give an example code to your problem which is came from FLASH MX load image
          here's the sample or go to www.macromedia.com/go/flashmx_sample find the load image

          //initialize variables and properties
          square._alpha = 0;
          whichPic = 1;
          //initiate change to new image when buttons are clicked
          next.onPress = function() {
          if (whichPic<5 && !fadeIn && !fadeOut) {
          fadeOut = true;
          whichpic++;
          input = whichPic;
          }
          };
          back.onPress = function() {
          if (whichPic>1 && !fadeIn && !fadeOut) {
          fadeOut = true;
          whichpic--;
          input = whichPic;
          }
          };
          _root.onEnterFrame = function() {
          // when a new Photo is selected, fade out, load new image, and fade in
          if (square._alpha>10 && fadeOut) {
          square._alpha -= 10;
          }
          if (square._alpha<10) {
          loadMovie("../images/image"+whichPic+".jpg", "square");
          fadeOut = false;
          fadeIn = true;
          }
          if (square._alpha<100 && fadeIn && !fadeOut) {
          square._alpha += 10;
          } else {
          fadeIn = false;
          }
          // limit input field
          if (input>5) {
          input = 5;
          }
          // initiate change to new image when Enter key is pressed
          if (Key.isDown(Key.ENTER)) {
          fadeOut = true;
          whichpic = input;
          }
          };
          // if a number is entered in the input field but Enter is not pressed, change
          // back to current Photo number when clicking anywhere else
          inputField.onKillFocus = function() {
          input = whichPic;
          };

          www.macromedia.com/go/flashmx_sample find the load image

          i hope it will help you!! have a nice day

          • 2. Re: action script2
            rebeccae Level 1
            makisiege - thanks for your response

            The function that i call now "loadNextImage()" does what this code does.

            What I need is to start an infinite loop, calling loadNextImage() with the DOWN key pressed. Then when the UP key is press it will end this infinite loop.