Hi Everyone-
I am up against a wall on this conversion project from AS3 to CreateJS.
Scenario:
When the user Right MouseDowns on an object it displays an "Action Window". However, when the use Left MouseDowns on the object and then Right MouseDowns it displays a different "Information Window". It works great. ONCE!
When the user colpetes both the Right Event and the Left/Right event ONLY the Left/Right Event will fire. The Right only event will not.
I have tried it different ways to make it work and the other attempt that somewhat worked was similar to the above however, the Information Window would appear with the Action Window.
Any help is appreciated as I have been hobbling code to convert a massive amount of flash this year and I am down to two pieces that are tripping me up. For the record, I am NOT a coder (so my approach may be janky) but it fell into my lap at work. Below is the code:
var _this = this;
//left click
_this.scene3501.on("mousedown", function (evt) {
var e = evt.nativeEvent;
var key = e.which || e.keyCode;
if (key === 1) {
_this.scene3501.gotoAndStop('selected');
_this.t22.gotoAndStop('on');
_this.wp.gotoAndStop('on');
console.log('left');
actionToggle1 = true
console.log('actionToggle1')
_this.scene3501.on("mousedown", leftrightClick3501);
}
});
function leftrightClick3501(evt){
var e = evt.nativeEvent;
var key = e.which || e.keyCode;
if ((key !== 1) && (actionToggle1 == true)) {
_this.infoMenu.visible=false
console.log('Leftright');
_this.actionMenu.visible = true
actionToggle1=false
_this.scene3501.removeEventListener("click", rightClick3501);
} else {
console.log ('didnt work')
}
}
//right click alone
_this.scene3501.addEventListener("click", rightClick3501);
function rightClick3501(evt){
var e = evt.nativeEvent;
var key = e.which || e.keyCode;
if (key !== 1) {
actionToggle1 = false
console.log('rightONLYscene3501');
_this.infoMenu.gotoAndStop('scene3501')
_this.infoMenu.alpha=100
_this.infoMenu.visible=true
}
_this.infoMenu.x = _this.infoMenu.x = 530
_this.infoMenu.y = _this.infoMenu.y = 200
// _this.scene3501.removeEventListener("click", leftrightClick3501);
}
What is the best way to reset the event listeners?