2 Replies Latest reply on Nov 14, 2008 5:53 AM by Newsgroup_User

    Detect if swf is visible

    boxmonkey
      Hello,
      I'm hoping someone can help me. My company has a Flex application that users keep open for hours at a time. It is a music player so users often start it and then minimize the browser window, switch to a new tab, etc. We need to be able to rotate ads, but we don't want to rotate ads when nobody is looking (obviously).

      Is there any way to detect whether or not the swf is visible at any given time? We don't care whether or not it has focus, only whether the user can see it.

      Thanks!
        • 1. Re: Detect if swf is visible
          *gsb* Level 1
          Interesting problem actually.
          I can only think of using focus somehow and perhaps a timer mechanism.

          • 2. Re: Detect if swf is visible
            Level 7

            "boxmonkey" <webforumsuser@macromedia.com> wrote in message
            news:gfiqem$4qs$1@forums.macromedia.com...
            > Hello,
            > I'm hoping someone can help me. My company has a Flex application that
            > users
            > keep open for hours at a time. It is a music player so users often start
            > it and
            > then minimize the browser window, switch to a new tab, etc. We need to be
            > able
            > to rotate ads, but we don't want to rotate ads when nobody is looking
            > (obviously).
            >
            > Is there any way to detect whether or not the swf is visible at any given
            > time? We don't care whether or not it has focus, only whether the user can
            > see
            > it.

            I'd look at the browser dom docs for your target browser(s) to see if they
            have any events that fire in these cases, then use ExternalInterface to let
            the browser tell your swf what happened.