views:

140

answers:

1

I'm looking for a way to determine if a Flash movie is visible within the browser viewport. Unfortunately there's a big caveat here: it must be done without JavaScript. Is there a native method, in Flash or Flex, that can detect when the movie becomes visible? I was thinking that the only way to do it would be some kind of low-level rendering or drawing event, but even those could fire when the movie is loaded on the page below the fold. Thanks.

+1  A: 

Nothing practical that you could use from within flash.

Different browsers behave differently when flash is not viewable (visibility:hidden or display:none).

Using ExternalInterface to perform a simple query shouldn't be a real problem, unless you're planning on embedding this flash file in environments where you do not control the "allowScriptAccess" parameter.

Lior Cohen
That's what I suspected. I'm not looking for visibility with regard to CSS or actually toggling the visibility property, I'm trying to find a way to detect whether it's been scrolled into view. Still thought I think we're in agreement that it really can't be done without JavaScript. And I won't be able to control allowScriptAccess.
nerdabilly
It may be worth noting that simply watching for mouse events or stage "activate" events may be good enough for many situations.
fenomas
@fenomas, possibly but those events require either the mouse to be in the movie or for the movie to gain OS focus. We'd like something a little more automatic than that.
nerdabilly