2 Replies Latest reply on Jun 20, 2007 2:07 AM by Tom_Kere

    Please Help with small Action Script Codes

    Tom_Kere
      Hi,

      I'm using CS3, action script 3.0. I have 6 buttons, each one that when clicked on will play a particular video. I've linked each button to the right video, but i can't work out how to make the videos invisible before you click the button. It must be simple, but i can't work it out!

      Second thing is that each button, when clicked, should also stop any other of the 6 videos that is already playing. What is the action script for that? Can't work it out either.

      Either the actual code, or where to go when using Script assist would be really appreciated!

      Thank you
        • 1. Re: Please Help with small Action Script Codes
          Urf Level 1
          You should be able to toggle the _visible attribute of each video on click and when it's loaded. You'll have to track the active video target name in a variable so you know which one to stop and make invisible when you click on the next one to play.

          An easier way to do this would be to have a single flash video movie object that you change the movie path on when you click each of your buttons. That way you're not loading all the videos all at once and you don't have to worry about hiding and showing them. It's as simple as coding:

          [videoComponentName].stop;
          [videoComponentName].contentPath = [relative path of the flv you want to play next]
          [videoComponentName].play;

          good luck!
          • 2. Re: Please Help with small Action Script Codes
            Tom_Kere Level 1
            Thank you for your reply...though i'm afraid my knowledge of flash is not that great and not everything you've said made sense.

            "An easier way to do this would be to have a single flash video movie object that you change the movie path on when you click each of your buttons. That way you're not loading all the videos all at once and you don't have to worry about hiding and showing them."

            So what you're saying i have one long flv that plays but each button can skip to a different part of the video?

            "[videoComponentName].stop;
            [videoComponentName].contentPath = [relative path of the flv you want to play next]
            [videoComponentName].play;"

            What do you mean by "relative path of the flv"? Do you mean the exact frame it should go to?

            Thanks again for your help.