3 Replies Latest reply on Dec 21, 2011 12:33 PM by Ned Murphy

    Basic presentation template hangs using event listeners

    rhysacymro

      Hello

       

      I've got a 'powerpoint style' slideshow built in Flash CS5, AS3, using the basic template (ie as on frame 1 root to advance frames on cursor keys). All works perfectly until I get to a MC which has the following script (snippets):

       

      button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);

       

      function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void

      {

                gotoAndPlay(2);

      }

       

      There are a number of these on the MC timeline to advance to different frames in sequence. All works perfectly, except that when it gets to the last frame. I press the cursor right to advance to the next root slide and it works. However this slide hangs... whatever the content. I deleted the AS on this MC and all works fine so it is definitely a conflict between the script above and the template frame control script:

       

      stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_changeSlide);

      function fl_changeSlide(evt:KeyboardEvent):void

      {

                if(evt.keyCode == 37) // LEFT

                {

                          gotoAndStop(this.currentFrame-1);

                }

                else if (evt.keyCode == 39 || evt.keyCode == 32) // RIGHT OR SPACE

                {

                          gotoAndStop(this.currentFrame+1);

                }

      }

      stop();

       

       

      Any ideas. PS If I wait about a minute, it starts working again (ie the frames advance as normal).

      thanks in advance

      rhys