PDA

View Full Version : Can someone help me with this mouse drag effect



answer10
October 5th, 2003, 07:28 AM
Lets say I have a movieclip with 20 frames. How can I script it so when i click and drag my mouse on the movieclip and to the left the movieclip will auto play from frames 1 to 10 then when I drag back and to the right the movieclip will play backward from 10 to 1 and then play from 11 to 20. This effect should also work vice versa if user first chooses to move to the right.

jingman
October 6th, 2003, 01:19 AM
Do you want the movie to play on it's own, at normal speed, or move along with the relative position of the mouse.

answer10
October 6th, 2003, 06:19 AM
Jingman thank you for replying, Yes I want the movie to play along with the relative position of the mouse.

dannyspace
October 6th, 2003, 11:26 PM
Im not exactly sure what is your question, but i try my best.

Create a MC and put the script :
onClipEvent(load){
gotoAndStop(10)
}

onClipEvent(enterFrame){
if ( Dragg==true){
if (_root._xmouse > _x){nextFrame()}
else if (_root._xmouse < _x){prevFrame()}
else {
if ( _currentFrame<10){nextFrame()}
if ( _currentFrame>10){prevFrame()}
}
_x=_root._xmouse
}
}


Add a button MC inside the MC above and add the script:

on(press){
Dragg=true
}

on(release,releaseOutside){
Dragg=false;
}

on(press){
Dragg=true
}

on(release,releaseOutside){
Dragg=false;
}

... cant say too much here. here is the FLA file (Flash5). hope this help.

http://www.dannyspace.com/temp/dragsample.fla

answer10
October 7th, 2003, 02:44 PM
thank you very much for replying dannyspace. I ran your dragsample and I see that when you click and drag the mouse to the left and then right the movie clips animation does play, but the only thing thats wrong is that the movieclip itself is following the mouse and I don't want that. I want the mouse action to only play the movieclips frames but i don't want the movieclip to follow the mouse.

jingman
October 7th, 2003, 02:51 PM
take out


_x = _root._xmouse;