Groups | Blog | Home
all groups > flash actionscript > july 2007 >

flash actionscript : Mouse button releasing problem


Armen Zen
7/28/2007 10:26:53 PM
IN A NUTSHELL---------------------------------
how can i write this line in Action Script?
while(mouse is not released) do {
whatever
}
--------------------------------------------------



I want; to add a script to a button , btw i was using Flash CS3 proffesional
and didn;t know you can't add a script to an object using as 3.0 so i was forcd
to use actionscript 2.0.

I want to add a script to a button instance name "R" that will move the object
instance name "timeline" to the left as long as you hold the mouse down. so i
have this so far but it will only move the timeline with a single click.... see
If i only knew how to write the while condition...

//on(press){
// while(cord == true){
// _root.timeline._x = _root.timeline._x - 10;
// }
//}

Thank you....
kglad
7/28/2007 11:23:35 PM
try:



on(press){
moveI=setInterval(moveF,60);
}
on(release){
clearInterval(moveI);
}

// attach the following to the frame that contains your button:

function moveF(){
_root.timeline._x -= 10;
}
Armen Zen
7/29/2007 12:00:00 AM
Figured it out...It was kinda weird, when i retyped the clearInterval(moveI) then it started to work. something about copy pasting that doesn't work.

Armen Zen
7/29/2007 12:54:23 AM
[q][i]Originally posted by: [b][b]kglad[/b][/b][/i]
try:

[/q]

thank you for your help........brilliant idea though it didn't work all to
well.. I studied your code and it makes sense it should work fine...As I click
on the button once it moves continuously, but when i release the button it
still continues to move...Interesting.. Also As i click on the button the speed
increases.
Thanks again.
kglad
7/29/2007 4:02:21 AM
kglad
7/29/2007 1:44:20 PM
AddThis Social Bookmark Button