3 Replies Latest reply on Jun 25, 2014 8:27 AM by dharmk

    Target Stage and append <iframe> from inside symbol????

    btaartdirector Level 1

      Having trouble again. I am SLOWLY getting use to the CC 2014 thing =).

      Now I need to be able to target a Symbol on the stage from within an element inside a symbol and append it with an <iframe> and pass attributes to the iframe.

      I have a file -- please refer to the  videoui symbol and whitewater1.click and whiteawater2.click actions in that symbol (link below (Drop Box)

       

      Here's what I have so far...

      // insert code for mouse click here

      // Go to a label or specific time and stop. For example:

      // sym.stop(500); or sym.stop("myLabel");

      sym.stop("videotwo");

       

      // Change the text in an element

      sym.$("video-text").html("Video by: TheNigglesbear");

       

       

      var youtubevidtwo = $("<iframe/>");

      sym.getComposition().getStage().getSymbol("vcontainer").append(youtubevidtwo);

       

      youtubevidtwo.attr('type','text/html');

      youtubevidtwo.attr('width','616');

      youtubevidtwo.attr('height','347');

      youtubevidtwo.attr('src','http://www.youtube.com/embed/eqzwoIQseyA?rel=0');  // url/Video_Id

      youtubevidtwo.attr('frameborder','0');       // 1 | 0

      youtubevidtwo.attr('allowfullscreen','0');   // 1 | 0

       

       

      This same code -with different path to symbol of course- works fine on the stage document.compositionReady, but not sure how to target the videoui and append the iframe and its attributes to it from inside another symbol.

       

      Help please -- there really needs to be more ADVANCED examples of possible methods of targeting. I find a lot about targeting symbols inside of symbols,or Stage to symbols, but not much on symbols to stage to another symbol also on the stage.

       

      Thanks in advance.

       

      Dropbox - videoPhotoUI.zip

        • 1. Re: Target Stage and append <iframe> from inside symbol????
          dharmk Adobe Employee

          Note that vcontainer is not a symbol instance, thus in the whitewater2 click handler you'll need to change the code at line number 11 from:

           

          $.getComposition().getStage().getSymbol("vcontainer")

           

          to the following:

           

          sym.getComposition().getStage().$("vcontainer")

           

          It will append a new iframe to the container though, if you need to replace the old one with the new video then you can try the following:

           

          var container = sym.getComposition().getStage().$("vcontainer");

          container.find("iframe").remove();

          container.append(youtubevidtwo);

           

          Hope this helps.

           

          -Dharmendra

          • 2. Re: Target Stage and append <iframe> from inside symbol????
            btaartdirector Level 1

            dharmk

             

            Thanks for the input. Just what I needed, I had to adjust my thinking, but got it to work because you took the time to look at my file and offer the help. Really appreciate it!! Here's how I made it work (for all three) video buttons:

             

            var container = sym.getComposition().getStage().$("vcontainer");

            container.find("iframe").remove();

            var youtubevidtwo = sym.getComposition().getStage().$("<iframe/>");

            sym.getComposition().getStage().$("vcontainer").append(youtubevidtwo);

             

             

            youtubevidtwo.attr('type','text/html');

            youtubevidtwo.attr('width','616');

            youtubevidtwo.attr('height','347');

            youtubevidtwo.attr('src','http://www.youtube.com/embed/eqzwoIQseyA?rel=0');  // url/Video_Id

            youtubevidtwo.attr('frameborder','0');       // 1 | 0

            youtubevidtwo.attr('allowfullscreen','0');   // 1 | 0

            • 3. Re: Target Stage and append <iframe> from inside symbol????
              dharmk Adobe Employee

              Its great to hear that it was useful and your problem is resolved. We too learn a lot from all of you by looking at the various ways you find to make use of the tool

               

              -Dharmendra