MOUSE OVER, ANIMATE
Hi guys,
I am a student and I am trying to show a movie clip when the mouse reaches my invisible button (on my second frame).
Well, it's not working at all.
And also, every time I put an EventListener, my button on the first frame stop working.
![]()
// FRAME 2:
this.stop();
var KEYCODE_LEF = 37;
var KEYCODE_RIGH = 39;
this.whisky1.visible = false;
this.b1.addEventListener("mouseover",onOver.bind(this));
this.b1.addEventListener("mouseout",onOut.bind(this));
function onOver(){
this.whisky1.visible = true;
this.b1.removeAllEventListeners();
}
function onOut(){
this.whisky1.visible = false;
this.b1.removeAllEventListeners();
}
document.onkeydown = handleKeyDown.bind(this);
function handleKeyDown(e) {
if (!e) {
var e = window.event;
}
switch (e.keyCode) {
case KEYCODE_LEF:
console.log("left");
this.bagsyMalone1.x -= 25;
if (this.bagsyMalone1.x <= 60){
this.gotoAndStop(2);
}
return false;
case KEYCODE_RIGH:
console.log("right");
this.bagsyMalone1.x += 25;
if (this.bagsyMalone1.x >= 450){
this.gotoAndStop(3);
}
return false;
}
}
// FRAME I:
this.stop();
this.justPlay1.addEventListener("click", gotoNextFrameAndStop.bind(this));
var KEYCODE_LEFT = 37;
var KEYCODE_RIGHT = 39;
document.onkeydown = handleKeyDown.bind(this);
function handleKeyDown(e) {
if (!e) {
var e = window.event;
}
switch (e.keyCode) {
case KEYCODE_LEFT:
console.log("left");
if (this.bagsyMalone1.x >= 60){
this.bagsyMalone1.x -= 10;
return false;
}
case KEYCODE_RIGHT:
console.log("right");
if (this.bagsyMalone1.x <= 450){
this.bagsyMalone1.x += 10;
return false;
}
}
}
function gotoNextFrameAndStop()
{
this.justPlay1.removeAllEventListeners();
this.gotoAndStop(1);
}
