2 Replies Latest reply on Apr 19, 2014 1:55 AM by jamesfootlight

    Can you help? Is there a simpler way to write this short code?

    jamesfootlight Level 1

      Hi, I'm quite new to coding and EDGE and feel that there must be a simpler way to write this?:

       

      sym.getSymbol("USA_animation").play();

      sym.getSymbol("World_map").play();

      sym.getComposition().getStage().getSymbol("UK_animation").$("UK").fadeOut();

      sym.getComposition().getStage().getSymbol("UK_animation").$("Piechart").fadeOut();

      sym.getComposition().getStage().getSymbol("UK_animation").$("people").fadeOut();

      sym.getComposition().getStage().getSymbol("UK_animation").$("PeopleText").fadeOut();

      sym.getComposition().getStage().getSymbol("UK_animation").$("UKText").fadeOut();

      sym.getComposition().getStage().getSymbol("AUS_animation").$("AUSTRALIA").fadeOut();

      sym.getComposition().getStage().getSymbol("USA_animation").$("USA").show();

      sym.getComposition().getStage().getSymbol("USA_animation").$("USAText").show();

       

      Can you help?

        • 1. Re: Can you help? Is there a simpler way to write this short code?
          hemanthR Adobe Employee

          One obivious way to increase efficiency is

          var USA_animation = sym.getSymbol("USA_animation")

          USA_animation.play();

          sym.getSymbol("World_map").play();

          USA_animation.$("UK").fadeOut();

          USA_animation.$("Piechart" ).fadeOut();

          USA_animation.$("people"). fadeOut();

          USA_animation.$("PeopleText").fadeOut();

          USA_animation.$("UKText").fadeOut();

          USA_animation.$("AUSTRALI A").fadeOut();

          USA_animation.$("USA").show();

          USA_animation.$("USAText" ).show();

           

          If you were performing a single operation on all the child symbols of 'USA_animation' you could further reduce it to somethinng like

          sym.getSymbol("World_map").play();

          var USA_animation = sym.getSymbol("USA_animation")

          USA_animation.play();

          var childSymbols = USA_animation.getChildSymbols(); f

          for(var i=0; i<childSymbols.length; i++)

          childSymbols[i].fadeOut();

           

          I am not sure if these are the best possible ways,but these are some ways i could think of.

          Let us know if you come up much shorted way to write this