3 Replies Latest reply on Apr 11, 2010 2:50 PM by Ned Murphy

    New Flash designer in need of help

    NathanBone

      Hi All,

       

      Wondered if I could pick your brains, I am trying to generate a piece of code that stops the animation at a point I want it to, then by pressing the 'space bar' or another key will prompt the animation to start again. I have tried to write this piece of code, but it does not work. Any tips or advice would be greatfully received.

       

      Many thanks

       

      Nathan

       

      ----------------------------

       

      stop ();

      on (release. keyPress "<Space>") {play ();

      }

        • 1. Re: New Flash designer in need of help
          Ned Murphy Adobe Community Professional & MVP

          "on" code belongs on objects, not on the timeline, but using code on objects is not a recommended practice.  Try using the following code in the timeline instead...

           

          stop ();

           

          var keyListener:Object = new Object();
          Key.addListener(keyListener);

           

          keyListener.onKeyUp = function(){
          if(Key.getCode() == 32){  // space key
            play();
          }
          }

          • 2. Re: New Flash designer in need of help
            NathanBone Level 1

            Hi Fella,

             

            Sorry to bug you, its not work the way I want it to. I have pasted the code into frame 11 of the file I am working on. I am trying to do a series of bullet points to for a presentation I am working on.

             

            The code stops the animation, but no keyboard clicks start it again :@( any ideas? However the spacebar and return key takes me to different slides within the file.

             

            Thanks

             

            Nathan

            • 3. Re: New Flash designer in need of help
              Ned Murphy Adobe Community Professional & MVP

              The code I provided will do what you indicated you want it to do.  You probably have other code that also reacts to using the keyboard... otherwise, nothing should happen if you don't.

              1 person found this helpful