0
votes

I got a simple flash scene that contain movie clip that contain sliding button that changing every few seconds: enter image description here

every layer contain a button and another movie clip. enter image description here

If I want to add event-listener to a simple button on stage, i just write:

f4.addEventListener(MouseEvent.CLICK, f4Click);

function f4Click(event:MouseEvent):void
{
    flash.external.ExternalInterface.call("dlHTCMD", "switchtogame?code=fnf50");
}

but when I'm trying to access the button inside the two movie clips, like

optContainer.optBeach.btnBeach.addEventListener(MouseEvent.CLICK, btnBeachClick);

and I'm adding a trace function to see if the event are triggered but nothing is happening.

looks like a simple problem but i didn't find a solution.

I thought about extending the button class and add a bind function with the value as the name of the button and set the Event Listener but I'm not an AS3 expert :(

Thanks.

1

1 Answers

0
votes

Try this:

// Pass mouse events to children
optContainer.mouseChildren = true;
optContainer.optBeach.mouseChildren = true;

// Reset hit area
optContainer.hitArea = null;
optContainer.optBeach.hitArea = null;

// Reset masks
optContainer.mask= null;
optContainer.optBeach.mask= null;

Also check whether on each key frame button have name.