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?
Best Answer
Good question!
I've done a quick test. There is a method called getObjectsUnderPoint() which
according to the documentation.
Also
So I don't know how helpful this might be.
Here's my test nevertheless:
I have some clips on stage, and I'm making some of them 'clickable'. Then onEnterFrame I'm checking if there are any instances of a subclass of InteractiveObject( the superclass for anything clickable )
For some reason in my test, getObjectsUnderPoint() returned only Shape objects, no Sprites. Maybe it might work in your configuration.
Also it seems a bit complicated.
Here's my second approach:
Use a recursive function that gets potentially interactive objective inside a clips(like the loader content). If it is either a Sprite or MovieClip, it's 'clickable'.
You can then do extra tests, depending on what exactly you're looking for ( either it has and event listener for mouse events, either it is mouseEnabled, has buttonMode set to true, etc. )
This way you don't need to check for any mouse over ( don't have to wait for user interaction or call a function all the time ) and once you got the clips that don't behave the way you want to, you can change their behavior (mouseChildren = false, or something).
HTH