0

I am experimenting a bit with Html5 canvas in Flash using the codesnippet embedded in the program. But I cant get the mouseover function to work. I have two MCs on my stage and trying to hide MC2 when mouseover on MC1.... pretty simple I would think. I have this code but its not working, what am I doing wrong?... and what does the variable "freaquency" do, and is it required?

var frequency = 3;
stage.enableMouseOver(frequency);
this.MC1.addEventListener("mouseover", fl_MouseOverHandler);

function fl_MouseOverHandler()
{
    this.MC2.visible = false;
}

Thanks in advanced

Kim

2 Answers2

0

I have run into similar issues with Canvas in the past, perhaps some other user will be able to explain the specifics of why it is happening, but I found the solution is generally to define your stage at the top of your code.

var mainStage = this;
var frequency = 3;
stage.enableMouseOver(frequency);
mainStage.MC1.addEventListener("mouseover", fl_MouseOverHandler);

function fl_MouseOverHandler()
{
    mainStage.MC2.visible = false;
}

for more information on what flash Canvas is actually doing I would recommend checking out the EaselJS documentation. Link to Description of what enableMouseOver is actually doing.

Malco
  • 352
  • 6
  • 18
  • 1
    Your approach solves the issue (scope), but I pointed to my answer on this question as another solution: http://stackoverflow.com/questions/33638757/how-to-target-a-movieclip-with-createjs/33639412#33639412 – Lanny Nov 13 '15 at 23:00
0

Thanks a lot, defining the mainstage in the beginning did the job... ;-)

Kim