Show/hide - Basic functionality
Hi, any idea why this code does not work as I think it should?
var _this = this;
_this.IN_mem.visible = true;
_this.IN_fig.visible = false;
stage.enableMouseOver(3);
_this.IN_btn.on('mouseover', function()
{
_this.IN_mem.visible = !_this.IN_mem.visible;
_this.IN_fig.visible = !_this.IN_fig.visible;
});
stage.enableMouseOver(3);
_this.IN_btn.on('mouseout', function()
{
_this.IN_mem.visible = !_this.IN_mem.visible;
_this.IN_fig.visible = !_this.IN_fig.visible;
});
What I would like is to have IN_mem visible and IN_fig invisible at the beginning.
Then when I mouseover the IN_btn I would like the reverse to happen: to have IN_mem invisible and IN_fig visible.
Then when I mouseout I would like to have the initial position: IN_mem visible and IN_fig invisible.
But what happens is:
When I mouseover:
- IN_mem disappears for a second and at the same time IN_fig appears for a second. Then they both go to their previous stages (IN_mem becomes visible again; IN_fig becomes invisible again)
- But I would like them to STAY (IN_mem invisible and IN_fig visible) in their new statue for as long as I mouseout.
When I mouseout nothing happens.
I do not understand that behaviour.
Isn't
_this.XXX.visible = !_this.XXX.visible;
supposed to do the oposite of the current visibility status and STAY in that status. Not return to the previous status after one second?
I also don't understand why nothing happens when I mouseout. But that's a secondary question, I suppose. I believe I should first be able to understand why mouseover isn't working as I think it should.
Thanks for any hint that you might have.
