//=========================================By Boricuaso============================================================
// here is a very simple anymation by button
// runs an anymationlayer
// in one direction when button pressed
// and then the other when button pressed again
// here is how it works: add below code to ?.xml
// and fill in the ?.
//
//
//
//
// //here you set the start and end frame of your animation.
//
//
// //dont forget this!
// ================================================================================
================================
#include
Global Button AnimButton;
Global AnimatedLayer Animlayer;
Global Layer animinfo;
Global Int a, frameX, frameY;
System.onScriptLoaded() {
Group ScrptGrp = System.getScriptGroup();
Animlayer = ScrptGrp.findObject("animationlayer"); //to add more animation and buttons change this to something ealse!!
AnimButton = ScrptGrp.findObject("animationbutton"); //to add more animation and buttons change this to something ealse!!
animinfo = ScrptGrp.findObject("animinfo"); //to add more animation and buttons change this to something ealse!!
frameX = StringToInteger(animinfo.getXMLparam("x"));
frameY = StringToInteger(animinfo.getXMLparam("y"));
a = 0;
}
AnimButton.onLeftButtonUp(int x, int y) {
if (a == 1 && AnimLayer.isStopped()) {
a = 0;
Animlayer.setStartFrame(frameX);
Animlayer.setEndFrame(frameY);
Animlayer.play();
} else if (a == 0 && AnimLayer.isStopped()) {
a = 1;
Animlayer.setStartFrame(frameY);
Animlayer.setEndFrame(frameX);
Animlayer.play();
}
}