-
[RESOLVED] Play/Rewind mc with mouse move top/bottom AS2
Hello,
I have a problem, i want to make a movieclip play when i move the mouse up and rewind when i move to the down, and when i don't move to continue playing or rewinding.
I have a code but it works only when i move the mouse up after half of the scene.
Actionscript Code:
this.onEnterFrame = function(){ if (action == "roll") { this.gotoAndStop (_currentframe + 1); }else if (action == "sstop") { this.gotoAndStop (_currentframe); }else if (action == "rew") { this.gotoAndStop(_currentframe - 1); } }
Actionscript Code:
onMouseMove=function(){ // go backward if(_currentframe != 1){ if(_ymouse>=0 && _ymouse<=Stage.height/2){ this.thatWay = rev; this.action = "rew"; } }else{gotoAndPlay(260)}
//go forward if(_currentframe != 260){ if(_ymouse>=Stage.height/2 && _ymouse<=Stage.height){ this.action = "roll"; } }else{gotoAndPlay(1)} }
this.action = "roll";
I want to follow somehow the mouse, when i move mouse up even a bit to change direction, now it changes direction only when i go after the half of scene, as in here http://www.scotch-soda.com/#/home
Hope anyone can help me.
Thanks.
-
Code:
onClipEvent (load) {
this.lastY = _ymouse;
this.action = "roll";
this.onEnterFrame = goME;
this.onMouseMove = doME;
function goME() {
if (this.action == "rew") {
this.prevFrame();
} else if (this.action == "roll") {
this.nextFrame();
} else {
this.stop();
}
}
function doME() {
if (this.lastY != _ymouse) {
if (this.lastY<_ymouse) {
this.action = "rew";
} else {
this.action = "roll";
}
this.lastY = _ymouse;
}
}
}
-
The onClipEvent (load){} did not work... dono why, but i put onMouseMove = function() {} and worked like a charm.
Thank you dawsonk.
Actionscript Code:
onMouseMove = function() { this.lastY = _ymouse; this.action = "roll"; this.onEnterFrame = goME; this.onMouseMove = doME;
function goME() { if (this.action == "rew") { this.prevFrame(); } else if (this.action == "roll") { this.nextFrame(); } else { this.stop(); } }
function doME() { if (this.lastY != _ymouse) { if (this.lastY<_ymouse) { this.action = "rew"; } else { this.action = "roll"; } this.lastY = _ymouse; } } }
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|