4 Replies Latest reply on Jul 15, 2013 12:05 AM by thedrupalpeople

    .hide(); not working

    bettiesac212

      I am making a multiple choice quiz. I want a symbol called try_again1 to play when the wrong answer is clicked, and a symbol called correct1 to play when the right answer is clicked. Of course when correct1 plays, try_again1 should disappear. They are in the same spot on the stage.

       

      Code for wrong answer:

       

      sym.getComposition().getStage().getSymbol("try_again1").play();  //works

       

      Code for right answer:

       

      sym.getComposition().getStage().getSymbol("correct1").play();  //works

      sym.getComposition().getStage().getSymbol("try_again1").hide();   //doesn't work

       

      Each time a wrong answer is clicked, try_again1just replays. But when the right answer is clicked, try_again1 will not disappear! (deleteSymbol() works, but then it won't play again when wrong answer is clicked in the next question.)

       

      Is there something astoundingly obvious I'm missing here?

        • 1. Re: .hide(); not working
          jbowden Adobe Employee

          Hi there,

           

          When you want to hide something, you need to get the jQuery handle of the element you want to hide. So try this:

           

          sym.getComposition().getStage().$("try_again1").hide();

           

          Or if you're calling at the Stage level, just:

           

          sym.$("try_again1").hide();

           

          hth,

          Joe

          • 2. Re: .hide(); not working
            bettiesac212 Level 1

            Thanks Joe! That did it.

             

            How would I know the difference between when to use normal jQuery and when to use Edge-specific code? For example, to play the symbol I use Edge-specific code, but to hide it I have to use regular jQuery. And as long as I'm on it, what is the difference between an element, a symbol and a symbol element?

            • 3. Re: .hide(); not working
              AMULI Level 4

              Hi Bettie,

               

              A very important fact is that you have simultaneously two hierarchies :

               

              • one made of symbol instances (may be what you call symbol elements ?).

              You traverse it to fire play(), stop(), etc methods ;

               

              • another one made of DOM elements.

              You traverse it to fire hide(), show(), etc methods

               

              You'll clarify all this by reading section Symbols vs. DOM elements in the following post :

               

              http://www.dehats.com/drupal/node/110

               

              Also look at section Traversing the symbol tree in the next post (part two).

               

              Gil

              • 4. Re: .hide(); not working
                thedrupalpeople

                You can also use the concepy of "toggle" jQuery function which is used in drupal sites.It is use to hide and display purpose. Here is simple code for toggle :

                jQuery("#try_again1").click(function(){

                        jQuery("#correct1").slideToggle();

                    });