View Full Version : Help needed
Christen
02-23-2005, 08:16 AM
Hi.. Was wondering what's the script to write if i want to have an action done repeatedly as long as the condition that the button is rollover or press = true?? thanks :confused:
Laguana
02-23-2005, 09:57 AM
There are at least 2 ways, but i'll go with the easiest.
You set a variable on the rollover or press, and change it when you roll out or stop pressing. Then you have an onEnterFrame which checks that variable and if it's set it does stuff. Like so:
on(Press){
this.beingPressed = true
}
on(Release) {
this.beingPressed = false
}
onClipEvent(enterFrame) {
if (this.beingPressed) {
// do stuff.
}
}
Christen
02-25-2005, 06:31 AM
Hmmm...not really sure of what to do about that.... is it possible for you to relate your answer to mine? as in...my button name is "left" and i want pix._x-- to be done.. Thanx
Laguana
02-25-2005, 07:34 AM
It's easier to do it with a movieclip, but i think this should work. Have the code on the main timeline
_root.left.onPress = function() {
_root.left.interval = setInterval(function() {_root.pix._x--}, 20)
}
_root.left.onRelease = _root.left.onReleaseOutside = function( ){
clearInterval(_root.left.interval)
}
Which will make _root.pix move 1 pixel left every 20 milliseconds while the button is pressed.
Flash Gordon
02-28-2005, 05:22 AM
well... for the easiest way i really depends what you want repeated. For example just don't put a stop(); on the MC that you want repeated.
on (rollOver) {
var toggle:Boolean = true;
if ( toggle) {
_root.movieClip_mc.gotoAndPlay(1);
}}
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.