Hi
Having trouble removing listeners.
I have a navigation between 2 scenes. Each scene has its own listener for different functions on same keys. The first play of each scene goes without problems. When i go back to the first scene the key.listener of scene 2 is active on this.
I even added a null on the first scene to see if the keys are overwritten. But the keys behave as if i was on the second scene.
Thanks
/* Scene1 */
Key.removeListener(myListener2);
var myListener1:Object = new Object();
myListener1.onKeyDown = function() {
if (Key.getCode() == Key.ENTER) {
gotoAndStop ("scene2", 1);
}
else if (Key.getCode() == Key.DOWN) {
null;
}
else if (Key.getCode() == Key.UP) {
null;
}
else if (Key.getCode() == Key.RIGHT) {
gotoAndStop ("scene2, 1");
}
};
Key.addListener(myListener1);
stop ();
/* Scene2 */
Key.removeListener(myListener1);
var myListener2:Object = new Object();
myListener2.onKeyDown = function() {
if (Key.getCode() == Key.ENTER) {
gotoAndStop ("scene3", 1);
}
else if (Key.getCode() == Key.DOWN) {
gotoAndStop ("frame1");
}
else if (Key.getCode() == Key.UP) {
gotoAndStop ("frame2");
}
else if (Key.getCode() == Key.LEFT) {
gotoAndStop ("scene1, 1");
}
};
Key.addListener(myListener2);
stop ();