user1174831
user1174831

Reputation: 3

Actionscript Event MOUSE_OVER/MOUSE_OUT not working properly

I am new to action script. I am trying to write a mouse out and over event for separate images. I want to display one image at a time by using mouseover mouse out events that call methods. The problem I am having is that the mouseover/out only displays one image. When I try to mouse over/out on a new image the image does not change, but the output displays a trace which means the event is being called. I am utilizing goToAndStop() method for each of my frames in my movie clip.

Below is one of my methods:

 function onOutTest(e:MouseEvent) {
        trace("onOutTest")
        overlay.visible=false;
    }

 function onOverTest(e:MouseEvent) {
        trace("onOverTest");
        addChild (overlay);
        overlay.gotoAndStop (1);
    }

I would appreciate any help.

Thanks.

Upvotes: 0

Views: 279

Answers (1)

annonymously
annonymously

Reputation: 4708

You should change it:

addChild(overlay);

function onOutTest(e:MouseEvent) {
    trace("onOutTest")
    overlay.visible = false;
}

function onOverTest(e:MouseEvent) {
    trace("onOverTest");
    overlay.visible = true;
    overlay.gotoAndStop(1);
}

Upvotes: 2

Related Questions