After closing top layer GFxMoviePlayer, new top GFxMoviePlayer ignores first mouse click

I have no idea why this is happening. I have a class that I use to open and close GFxMoviePlayers. Topmost movie has highest priority and focus. I call these functions on my custom GFxMoviePlayer class as they move to the top layer:

function OnLayerBuried()
{
	bIgnoreMouseInput = true;
	SetMovieCanReceiveInput(false);
	SetMovieCanReceiveFocus(false);
}

function OnLayerRevealed()
{
	bIgnoreMouseInput = false;
	SetMovieCanReceiveInput(true);
	SetMovieCanReceiveFocus(true);
}

This works fine for all of my classes except one. I have no idea why it’s not working there… Or rather, it’s working 99%. In one specific Scaleform layer, when it gets set back to the top layer, it ignores the first mouse click. After that mouse click, everything works normally. I have no idea why it ignores that first click.

I put this on the timeline of my fla file:

import flash.events.MouseEvent;

stage.addEventListener(MouseEvent.CLICK, logClick);

function logClick(e:MouseEvent):void {
	if(e.target != null) {
		if(DisplayObject(e.target) != null) {
			ExternalInterface.call("Log", "Click: " + String(e.target) + " " + DisplayObject(e.target).name);
		}
		else {
			ExternalInterface.call("Log", "Click: " + String(e.target));
		}
	}
	else  {
		ExternalInterface.call("Log", "Click: null");
	}
}

The Log function it’s calling does just what you would expect. When I have that movieplayer open, and I click on things, they all get logged into the UDK log window. But when I open a new top layer movieplayer, and close it and return to this movieplayer, this function doesn’t fire on the first click. After that first mouse click, this function writes to the log as expected.

So I tried firing a fake mouse click to the movie when it gets uncovered as the top layer:

UScript:

ActionScriptVoid("fakeMouseClick");

ActionScript:

		public function fakeMouseClick():void {
			ExternalInterface.call("Log", "fakeMouseClick()");
			dispatchEvent(new MouseEvent(MouseEvent.CLICK));
		}

But that doesn’t trick the movieplayer. It still ignores the first real click.

I thought maybe the movieplayer needed to resume play, so I tried calling Start() and Advance(0.f), but neither of those worked. I also tried calling fakeMouseClick() after a short delay. And the movieplayer still ignores the first mouse click.

Have any of you ever had this problem? Why does the GFxMoviePlayer ignore the first mouse click? How did you fix it?

Edit: I just tried something else. I commented out everything inside OnLayerBuried and now it responds to the first mouse click, but there are a bunch of other problems with that (not least of which is the lower priority movieplayer responding to the mouse while a higher priority movieplayer is up). I’ll keep working on it.

I don’t know what is happening, but you can try to add a small timeout (100ms) to fake your first click.