home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 November
/
CDVD1105.ISO
/
Util
/
Winamp
/
Skins
/
Anime_Shogo.wal
/
scripts
/
animbutton.m
< prev
next >
Wrap
Text File
|
2004-08-26
|
3KB
|
79 lines
//=========================================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 ?.
// <button
// id="animationbutton" // dont change
// x="?" y="?"
// image="?"
// downImage="?"
// activeImage="?"
// hoverImage="?"
// />
//
// <AnimatedLayer
// x="?" y="?"
// w="149" h="65" //single frame w,h.
// id="animationlayer" // dont change
// image="?"
// move="1"
// speed="50" //set your speed default is 200ms witch is the slowest oms the fastest.
// autoplay="0" // dont change
// autoreplay="0" // dont change
// sysregion="1"
// />
//
// <layer id="animinfo" x="10" y="0" /> //here you set the start and end frame of your animation.
// <!-- x="last image or frame" y="first image or frame" -->
//
// <script id="animbybutton" file="scripts/animbybutton.maki" /> //dont forget this!
// ================================================================================
================================
#include </lib/std.mi>
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();
}
}