Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : Loop on Rollover


gbhumphrey
5/14/2004 11:30:34 PM
Hi all, Im a newbie to Actionscript and here's my problem. I want an event to
loop during a rollOver. Here's the code I have
on (rollOver) {
setProperty("filmstrip", _y, Number(getProperty("filmstrip", _y)-50));
}
What happens here is the "filmstrip" movie gets moved 50 pixels ONCE. I want
to continue to move it as long as the cursor is in the hit area of a button. It
seems some sort of simple loop and on (rollOut) function would do, but I dont
know how to code that yet.
Please help!
kglad
5/14/2004 11:51:11 PM
attached to your button:

on(rollOver){
moveI=setInterval(moveF,100,filmstrip);
}
on(rollOut){
clearInterval(moveI);
// filmstrip._y = ? : you may want to reset filmstrip's _y property.

and attached to a frame:

function moveF(mc){
mc._y -= 50; // this is a pretty large movement. you may want 3 or 5 instead
of 50.
}
}
AddThis Social Bookmark Button