3 Replies Latest reply on May 18, 2007 9:31 AM by necie

    if/else actionscript to play/pause timeline with same key stroke

    necie
      I am creating a presentation where I have to play some flv's. I want to create a button that is invisible that will play the video when you press the space bar and then puase it when you hit the space bar again. I need some help in the else/if actionscript so I can have just one key stroke to play/pause the video. Can anyone help?
        • 1. Re: if/else actionscript to play/pause flv with same key stroke
          joeschmoesdf
          if you are using a ready made flash player break the pause/play button apart from the rest and just change the as so that on the press of w/e button you wish it pauses/plays not "on (release)"

          If you are not using a ready made one I recommend it
          • 2. Re: if/else actionscript to play/pause flv with same key stroke
            necie Level 1
            Thanks for the suggestion. But maybe I over elaborated on my problem. I think all I need is a little bit of actionscript to control a timeline. I mentioned an .flv file but really I need to control a simple timeline.

            Press space bar to play if timeline is currently stopped or pause if timeline is currently playing.

            The ida is that at anypoint in my animation the person presenting can pause or play the timeline with a single press of the space bar. Any help with that and my problem will be solved.
            • 3. if/else actionscript to play/pause flv with same key stroke
              necie Level 1
              I found a solution but it's just not as simple as I had hoped. I created a mc with two frames and with buttons on each frame. My main timeline begins with a stop() and the mc is placed on the main timeline as well. the first frame of the mc has this actionscript attached to the button:

              on (release, keyPress "<Space>") {
              _root.play()
              gotoAndStop(2);
              }

              the second button on the second frame has this actionscript:

              on (release, keyPress "<Space>") {
              _root.stop()
              gotoAndStop(1);
              }

              I would love to still find out how I can do this on the main timeline without a mc using only one button with actionscript.