2 Replies Latest reply on Dec 3, 2014 7:43 AM by CTLVideo

    How do I create a single action that hides several elements at once?


      I'm creating what I call a "video jukebox" and I'd like to find an easier way to switch between videos, depending on which button is clicked. For instance, I have 7 videos for the viewer to choose from.

      On the Animate Stage are 7 buttons, each button corresponding to the appropriate video.

      I've also added the 7 videos to the Stage (let's call them Video01.mp4, Video02.mp4, etc).

      To each button I've added the following actions to mousedown:








      I would then change "hide" to "show" depending on which video I want to play when the viewer clicks on the corresponding button, and assign that to a mouseup action.


      I am wondering 2 things:

      1. Is there an action that will hide all of the videos with one line of code, instead of repeating it multiple times (for each video)?

      2. Can I assign the code to a transparent symbol that I can overlay each button so I don't have to open the actions for each one? In other words, I'd like to just drag a symbol onto the Stage and have the code already attached to it, then all I'd have to do is change one or 2 lines instead of having to rewrite the entire thing each time.



        • 1. Re: How do I create a single action that hides several elements at once?
          vivekuma Adobe Employee

          1. sym.$("video").hide(); will hide all the video elements, then you can selectively show a particular video  as sym.$("Vidoe01").show();

          2. Write a function in the compositionReady like:

                    sym.hideShowVideo = function(name) {





          And call this function for each button like sym.hideShowVideo("Video01");




          • 2. Re: How do I create a single action that hides several elements at once?
            CTLVideo Level 1

            Thanks, that worked great! However, I've discovered that merely hiding the video won't accomplish what I want since it's still playing in the background. So, I added a bit more code to make that functionality work as well. If anyone reading this is looking to do something similar, here's the code I added after the showHide ending bracket:

            sym.playPauseVideo = function(name) {