How do I reset 16 draggable and text editable symbols to revert to original state via a button?
here code:
// insert code run when symbol 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 draggable jquery ui plugin mydraggablesymbol symbol on stage
sym.$('risk3_orange').draggable({
start: function(e){},
drag: function(e,ui)
{
sym.getsymbol("risk3_orange").stop("initial");
sym.setvariable("symname","risk3_orange");
}
}
);
//adding risk3_orange add 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 risk2 add 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 risk3 add 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 risk4 add 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 risk5 add 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 risk6 add 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 risk7 add 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 risk8 add 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 risk9 add 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 risk10 add 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 risk11 add 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 risk12 add 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 risk13 add 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 risk14 add 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 risk15 add 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 risk16 add 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");
}
});
}
could post link files? am, not sure going on without seeing it.
see sample using loop: https://app.box.com/s/uj6ihft6kd0pqgc8h5sc
in mean time make changes simplify code.
1- load scripts script loading instead.
2- run loop this:
// crate array of symbols
var risk = ['risk2','risk3','risk4','risk5','risk6','risk7','risk8','risk9','risk10','risk11','risk1 2','risk13','risk14','risk15','risk16','risk3_orange'];
for (i=0;i<risk.lenght;i++){
sym.getsymbol(risk[i]).$(risk[i]).attr("contenteditable",true);
sym.$(risk[i]).draggable({
start: function(e){},
drag: function(e,ui){
sym.getsymbol(risk[i]).stop("initial");
//sym.setvariable("symname","risk3_orange");
}
}
);
//adding risk3_orange add other symbols
sym.$(risk[i]).draggable();
sym.getsymbol(risk[i]).$(risk[i]).dblclick(function(ev) {
sym.$(risk[i]).draggable('disable');
}).click(function(ev) {
sym.$(risk[i]).draggable('enable');
});
} // end of loop
More discussions in Edge Animate CC
adobe
Comments
Post a Comment