I'm building a specialized viewer application which loads external SWFs.
var content:Sprite = ...
content.addChild(loader);
I listen to my top level content Sprite MOUSE_OVER and MOUSE_OUT events. The over handler hides default cursor and displays a custom (zoom) cursor. Out handler changes cursor back to default.
What I want to achieve is NOT showing the zoom cursor when the mouse is over a clickable item in the externally loaded SWF like a button or textlink.
The current code works perfectly for AVM1 swfs. The problem lies with loaded swfs using AS3. For these the content MOUSE_OUT is fired and instantly MOUSE_OVER is fired as well, so the cursor remains wrong.
What this probably boils down to is: How to check the mouse is over a clickable child of content?
With some testing and the hint George gave me, this is the content MOUSE_OVER
listener I just wrote (in Haxe) which seems to work:
public var mouseOverClickableContent:Bool;
private function onOverContentChild(event)
{
mouseOverClickableContent = false;
if (event.target != content)
{
var obj:flash.display.InteractiveObject = cast event.target;
while (obj != content)
{
if ( obj.hasEventListener(flash.events.MouseEvent.CLICK)
|| obj.hasEventListener(flash.events.MouseEvent.MOUSE_UP)
|| obj.hasEventListener(flash.events.MouseEvent.MOUSE_DOWN)
|| ( Std.is(obj, Sprite) && cast(obj, Sprite).buttonMode )
){
mouseOverClickableContent = true;
break;
}
obj = obj.parent;
}
}
}
Unfortunately, there seems to be no way of detecting if the mouse is over a TextField htmlText link, so I could add a TextField htmlText.indexOf("<a") != -1
check there.
Unless someone knows a trick to detect mouse-over-textfield-links?