rintaro82
8th October 2002, 11:31
hi all. can someone out there tell me why this script doesn't work? it's supposed to cause a layer ("push") to slide across a 70 pixel area in time to the song which is playing.
#include "../../../lib/std.mi"
global layer mybutton;
global group mybuttongroup;
global timer mytimer;
system.onscriptloaded()
{
mybuttongroup = getscriptgroup();
mybutton = mybuttongroup.findobject("Push");
mytimer = new timer;
mytimer.setdelay(1000);
}
system.onplay()
{
mytimer.start();
}
mytimer.ontimer()
{
if (system.getplayitemlength() > 0)
{
float played = system.getposition();
played = played / system.getplayitemlength();
int setX = 70 * played;
mybutton.resize(setX,20,20,20);
mybutton.fx_update();
}
}
i realize there is nothing in there to bring the layer back to the beginning, but i'm just trying to get the guts work at this point. i also realize that i really don't know what i'm doing here, so it might be something stupid.
in case it's important, "push" is defined in my player.xml simply as a 20 X 20 layer at x="100" and y="20".
thanks in advance!
#include "../../../lib/std.mi"
global layer mybutton;
global group mybuttongroup;
global timer mytimer;
system.onscriptloaded()
{
mybuttongroup = getscriptgroup();
mybutton = mybuttongroup.findobject("Push");
mytimer = new timer;
mytimer.setdelay(1000);
}
system.onplay()
{
mytimer.start();
}
mytimer.ontimer()
{
if (system.getplayitemlength() > 0)
{
float played = system.getposition();
played = played / system.getplayitemlength();
int setX = 70 * played;
mybutton.resize(setX,20,20,20);
mybutton.fx_update();
}
}
i realize there is nothing in there to bring the layer back to the beginning, but i'm just trying to get the guts work at this point. i also realize that i really don't know what i'm doing here, so it might be something stupid.
in case it's important, "push" is defined in my player.xml simply as a 20 X 20 layer at x="100" and y="20".
thanks in advance!