3 Replies Latest reply on May 18, 2016 9:21 AM by kglad

    AS3 Slideshow control with Keyboard

    MoD_Andy Level 1

      Hi all,

       

      I'm pretty much new to AS3 and Im struggling with some AS3 to control a slideshow.

       

      I currently have this...

       

      stop();
      
      
      stage.addEventListener(MouseEvent.CLICK,mouseClicked);
      stage.addEventListener(KeyboardEvent.KEY_DOWN,keyPressed);
      function mouseClicked(ev:MouseEvent):void {
       nextframe();
      }
      function keyPressed(ev:KeyboardEvent):void {
       if (ev.keyCode==32) {
        nextframe();
       }
      }
      function nextframe() {
       if (this.currentFrame<this.totalFrames) {
        this.nextFrame();
       } else {
        trace("End of Slide Show");
       }
      }
      

       

      Which seem to work OK, on click of mouse or spacebar, root timeline skips to next frame which contains a movieClip of a slide which plays and stops, and so on.

       

      Basically what I'd like to add is the ability to go back a frame on say the press of the delete keep and if possible the ability to go direct to each slide with the press of a number key. ie. press 3 to jump direct to slide 3, press 6 to go to 6 etc. which I gather would target frame labels.

       

      Thanks in advance

       

      Andy