14 Replies Latest reply on Mar 21, 2014 8:11 AM by jamesfootlight

    How do I reset 16 draggable and text editable symbols to revert to original state via a button?

    jamesfootlight

      Here is my code:

       

      // insert code to be run when the symbol is created here

      sym.getSymbol("Risk2").$("Risk2").attr("contenteditable",true);

      sym.getSymbol("Risk3").$("Risk3").attr("contenteditable",true);

      sym.getSymbol("Risk4").$("Risk4").attr("contenteditable",true);

      sym.getSymbol("Risk5").$("Risk5").attr("contenteditable",true);

      sym.getSymbol("Risk6").$("Risk6").attr("contenteditable",true);

      sym.getSymbol("Risk7").$("Risk7").attr("contenteditable",true);

      sym.getSymbol("Risk8").$("Risk8").attr("contenteditable",true);

      sym.getSymbol("Risk9").$("Risk9").attr("contenteditable",true);

      sym.getSymbol("Risk10").$("Risk10").attr("contenteditable",true);

      sym.getSymbol("Risk11").$("Risk11").attr("contenteditable",true);

      sym.getSymbol("Risk12").$("Risk12").attr("contenteditable",true);

      sym.getSymbol("Risk13").$("Risk13").attr("contenteditable",true);

      sym.getSymbol("Risk14").$("Risk14").attr("contenteditable",true);

      sym.getSymbol("Risk15").$("Risk15").attr("contenteditable",true);

      sym.getSymbol("Risk16").$("Risk16").attr("contenteditable",true);

      sym.getSymbol("risk3_orange").$("risk3_orange").attr("contenteditable",true);

       

       

      yepnope(

       

       

      {nope:['js/jquery-ui-1.10.0.custom.min.js','js/jquery.ui.touch-punch.min.js', 'js/jquery-ui-1.10.4.custom.min.js'],

       

       

      complete: init

       

       

      });

       

       

      function init(){

       

       

      // apply the draggable JQuery UI plugin to the MyDraggableSymbol symbol on your stage

      sym.$('risk3_orange').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("risk3_orange").stop("Initial");

                          sym.setVariable("symName","risk3_orange");

                }

      }

      );

       

       

      //adding for risk3_orange similarly add for other symbols

      sym.$('risk3_orange').draggable();

      sym.getSymbol('risk3_orange').$("risk3_orange").dblclick(function(ev) {

           sym.$('risk3_orange').draggable('disable');

      }).click(function(ev) {

           sym.$('risk3_orange').draggable('enable');

      });

       

       

      sym.$('Risk2').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk2").stop("Initial");

                          sym.setVariable("symName","Risk2");

                }

      }

      );

       

       

      //adding for Risk2 similarly add for other symbols

      sym.$('Risk2').draggable();

      sym.getSymbol('Risk2').$("Risk2").dblclick(function(ev) {

           sym.$('Risk2').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk2').draggable('enable');

      });

       

       

       

       

      sym.$('Risk3').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk3").stop("Initial");

                          sym.setVariable("symName","Risk3");

                }

      }

      );

       

       

      //adding for Risk3 similarly add for other symbols

      sym.$('Risk3').draggable();

      sym.getSymbol('Risk3').$("Risk3").dblclick(function(ev) {

           sym.$('Risk3').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk3').draggable('enable');

      });

       

       

       

       

      sym.$('Risk4').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk4").stop("Initial");

                          sym.setVariable("symName","Risk4");

                }

      }

      );

       

       

      //adding for Risk4 similarly add for other symbols

      sym.$('Risk4').draggable();

      sym.getSymbol('Risk4').$("Risk4").dblclick(function(ev) {

           sym.$('Risk4').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk4').draggable('enable');

      });

       

       

      sym.$('Risk5').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk5").stop("Initial");

                          sym.setVariable("symName","Risk5");

                }

      }

      );

       

       

      //adding for Risk5 similarly add for other symbols

      sym.$('Risk5').draggable();

      sym.getSymbol('Risk5').$("Risk5").dblclick(function(ev) {

           sym.$('Risk5').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk5').draggable('enable');

      });

       

       

      sym.$('Risk6').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk6").stop("Initial");

                          sym.setVariable("symName","Risk6");

                }

      }

      );

       

       

      //adding for Risk6 similarly add for other symbols

      sym.$('Risk6').draggable();

      sym.getSymbol('Risk6').$("Risk6").dblclick(function(ev) {

           sym.$('Risk6').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk6').draggable('enable');

      });

       

       

      sym.$('Risk7').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk7").stop("Initial");

                          sym.setVariable("symName","Risk7");

                }

      }

      );

       

       

      //adding for Risk7 similarly add for other symbols

      sym.$('Risk7').draggable();

      sym.getSymbol('Risk7').$("Risk7").dblclick(function(ev) {

           sym.$('Risk7').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk7').draggable('enable');

      });

       

       

      sym.$('Risk8').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk8").stop("Initial");

                          sym.setVariable("symName","Risk8");

                }

      }

      );

       

       

      //adding for Risk8 similarly add for other symbols

      sym.$('Risk8').draggable();

      sym.getSymbol('Risk8').$("Risk8").dblclick(function(ev) {

           sym.$('Risk8').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk8').draggable('enable');

      });

       

       

      sym.$('Risk9').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk9").stop("Initial");

                          sym.setVariable("symName","Risk9");

                }

      }

      );

       

       

      //adding for Risk9 similarly add for other symbols

      sym.$('Risk9').draggable();

      sym.getSymbol('Risk9').$("Risk9").dblclick(function(ev) {

           sym.$('Risk9').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk9').draggable('enable');

      });

       

       

      sym.$('Risk10').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk10").stop("Initial");

                          sym.setVariable("symName","Risk10");

                }

      }

      );

       

       

      //adding for Risk10 similarly add for other symbols

      sym.$('Risk10').draggable();

      sym.getSymbol('Risk10').$("Risk10").dblclick(function(ev) {

           sym.$('Risk10').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk10').draggable('enable');

      });

       

       

      sym.$('Risk11').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk11").stop("Initial");

                          sym.setVariable("symName","Risk11");

                }

      }

      );

       

       

      //adding for Risk11 similarly add for other symbols

      sym.$('Risk11').draggable();

      sym.getSymbol('Risk11').$("Risk11").dblclick(function(ev) {

           sym.$('Risk11').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk11').draggable('enable');

      });

       

       

      sym.$('Risk12').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk12").stop("Initial");

                          sym.setVariable("symName","Risk12");

                }

      }

      );

       

       

      //adding for Risk12 similarly add for other symbols

      sym.$('Risk12').draggable();

      sym.getSymbol('Risk12').$("Risk12").dblclick(function(ev) {

           sym.$('Risk12').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk12').draggable('enable');

      });

       

       

      sym.$('Risk13').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk13").stop("Initial");

                          sym.setVariable("symName","Risk13");

                }

      }

      );

       

       

      //adding for Risk13 similarly add for other symbols

      sym.$('Risk13').draggable();

      sym.getSymbol('Risk13').$("Risk13").dblclick(function(ev) {

           sym.$('Risk13').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk13').draggable('enable');

      });

       

       

       

       

      sym.$('Risk14').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk14").stop("Initial");

                          sym.setVariable("symName","Risk14");

                }

      }

      );

       

       

      //adding for Risk14 similarly add for other symbols

      sym.$('Risk14').draggable();

      sym.getSymbol('Risk14').$("Risk14").dblclick(function(ev) {

           sym.$('Risk14').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk14').draggable('enable');

      });

       

       

      sym.$('Risk15').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk15").stop("Initial");

                          sym.setVariable("symName","Risk15");

                }

      }

      );

       

       

      //adding for Risk15 similarly add for other symbols

      sym.$('Risk15').draggable();

      sym.getSymbol('Risk15').$("Risk15").dblclick(function(ev) {

           sym.$('Risk15').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk15').draggable('enable');

      });

       

       

      sym.$('Risk16').draggable({

      start: function(e){},

      drag: function(e,ui)

                {

                          sym.getSymbol("Risk16").stop("Initial");

                          sym.setVariable("symName","Risk16");

                }

      }

      );

       

       

      //adding for Risk16 similarly add for other symbols

      sym.$('Risk16').draggable();

      sym.getSymbol('Risk16').$("Risk16").dblclick(function(ev) {

           sym.$('Risk16').draggable('disable');

      }).click(function(ev) {

           sym.$('Risk16').draggable('enable');

      });

       

       

      sym.getSymbol("Drop").$('Outer').droppable({

      drop: function(event, ui)

      {

      var myVariable = sym.getVariable("symName");

       

       

      sym.getSymbol(myVariable).stop("Green");

      }

      });

       

       

      sym.getSymbol("Drop").$('Middle').droppable({

      drop: function(event, ui)

      {

      var myVariable = sym.getVariable("symName");

      sym.getSymbol(myVariable).stop("Blue");

       

       

      }

      });

       

       

      sym.getSymbol("Drop").$('Target').droppable({

      drop: function(event, ui)

      {

      var myVariable = sym.getVariable("symName")

      sym.getSymbol(myVariable).stop("Red");

       

       

      }

      });

       

       

      }