Continusly movement on button hold

so yeah like it says i want to have a button and when you hold it a movie clip continusuly moves downward. so yeah.

basically there is no option that i can uses such as

on(hold);

cause well thats not a script. so anyways anyone know how i can do this? or how i can check to see if the mouse is pressed over the button?

Here, I’m not boasting or anything but look at the buttons on the top of my page and tell me if this is what you are talking about? I did my buttons as movieclips with a ‘dummy_button’ over the top of them for the actionscript (i.e. rollOver,rollOut etc). This way it gives you more options as to what you want your buttons to act like.

My site: http://rberry883.home.comcast.net

If this is not what you are looking for then disregard the above (and stop laughing at my site! :slight_smile: ) and someone who knows what they are doing can help you.

give the movieclip an instance name, my example will be imaginatively named myMC :P.

on your button, have an on(press) event as follows… assuming the movieclip is on the _root level:

on (press) {
	_root.myMC.onEnterFrame = function(){
		this._y++
	}
}
on (release) {
	delete _root.myMC.onEnterFrame
}

note you mite want an on(releaseOutside) identical to on(release)

Prophet.

Prophet is right on about this… you can, however, use the same function for release and releaseOutside. the whole code would be as follows:

  
on (press) {
	   _root.myMC.onEnterFrame = function(){
			  this._y++
   }
}
on (release, releaseOutside) {
   delete _root.myMC.onEnterFrame
}
 

thanks mattvenables… i didnt actually know that!! u learn sumit evryday :wink: lol

Prophet.

on(rollOver){
	gotoAndPlay("over");
}
on(press){
	gotoAndPlay("down");
}
on(rollOut, releaseOutside){
	gotoAndPlay("goback");
}
on(release){
	with(_root){
		gotoAndPlay("Home");
}
}

This is the actionscript for the dummy button that acts as the hit area of my movieclip buttons. Maybe not the cleanest I like it better than trying to get button symbols to behave with something more than just up,down,over.

mattvenables, prophet worked great. anyways i guess with it being y++ theres no way i could speed it up without increasing the fps?

also another quick question, how do i load (or “activate”) a movie clip from a button.

anyways great replies.

:bump:

simply change y++ to y+=x and rather than increase by 1, it will increase y by however many x represents (eg. y+=5)

give your mc an instance name and use its path to activate it: easiest way, have a blank frame on first frame and have action stop() on it and then on your button use sumit like _root.myMC.play() wer myMC is the instance name you gave it… assuming your mc is on the main timeline :wink:

Prophet.

PS glad i could help :wink:

wow i guess i was thinking it would be really complicated like _root.load.function.math.pi(54%6);;{}sd.mymc i dunno oh well worked great again.

happy flashing :slight_smile:

Prophet.

hehe. I love to flash :wink: