Pergunta

I'm working on a video player and I though that it could be usefull to include the fullscreen's function when the user double click on the stage.

I've done some research but I'm stuck right now because of this line:

 player.display.mouseChildren = false;

I read somewhere that I have to include this before those:

player.display.doubleClickEnabled = true;
player.display.addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickFS, false, 0, true);

However, if mouseChildren is false, the children are not working ^^'. Do you have an idea to fix this ?

Thank you, Lea.

Foi útil?

Solução

Here is a cheat solution.

You just make a full size sprite over all layers, and set it to alpha 0.

Add double click listener to the sprite and set mouseChildren to false, this won't effect your player.

I just screwed up the event flow in AS3. Here is also a cheat solution.

Make your own DOUBLE_CLICK event use CLICK event.

var lastClickTime:Number = 0;
mc.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void
{
    var curTime:Number = getTimer();
    if( curTime - lastClickTime < 300 )
    {
        trace("Double Click");
    }
    else
    {
        trace("Single Click");
    }
    lastClickTime = curTime;
});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top