A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Returning focus to a a site after coosing a pop-up

  1. #1
    Member
    Join Date
    Jan 2002
    Posts
    82

    Returning focus to a a site after coosing a pop-up

    I've developed a site which is navigated with the keyboard.
    Certain actions generate popups.

    Is there a way, either through javascript or actionscript that I can make the site return focus to itself when a pop up has been closed?

    Otherwise the user has to click on the site after a pop-up to get it back in focus, and this kills the usability.

    I've done a search on the forum, and the only solutions which I have found are those which make the swf reload, which is something I have to avoid.

    You can try it out here
    http://www.vulvair.co.uk/major/

    Thanks in advance.

  2. #2
    Member
    Join Date
    Jan 2002
    Posts
    82
    Update, I found a thread which suggesting using this code in the html page to set focus when the page loads, so I guess there is a way to run that code fomr a window when it closes using javascript, nut I have no idea how.

    <BODY onLoad="window.document.movieName.focus();" bgcolor="#E6DDC4" >

    <!-- URL's used in the movie-->
    <!-- text used in the movie-->
    <!--codesicklove-->
    <p align="center">
    <OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
    WIDTH="537" HEIGHT="500" ALIGN="top" id="movieName" >
    <PARAM NAME=movie VALUE="website.swf">
    <PARAM NAME=loop VALUE=false>
    <PARAM NAME=menu VALUE=false>
    <PARAM NAME=quality VALUE=high>
    <PARAM NAME=bgcolor VALUE=#FFFFFF>
    <EMBED src="website.swf" name = "movieName" swLiveConnect=true loop=false menu=false quality=high bgcolor=#FFFFFF WIDTH="537" HEIGHT="500" ALIGN="top"
    TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
    </OBJECT>
    </p>
    <p align="center">&nbsp;</p>
    <p>&nbsp;</p>
    </BODY>
    </HTML>

  3. #3
    Member
    Join Date
    Mar 2001
    Posts
    73
    In the html of your pop-up, try:

    <body onUnload="window.opener.document.movieName.focus() ">

    that will usually work

  4. #4
    Member
    Join Date
    Jan 2002
    Posts
    82
    Unfortunately it doesn't work, I am using the code I posted above in the launching site, and the code you suggested in the body of the holder page.

    I can paste you the entire code of either of the pages if that can help.

    Thanks for helping as I need to have this finnnsihed this evening.

  5. #5
    Member
    Join Date
    Mar 2001
    Posts
    73
    Ok, I tried this and it works...

    In your popup's body tag put:

    onUnload="opener.focus()"

    In the body tag of your main window, leave the onLoad attribute and add:

    onFocus="window.movieName.focus()"

    For testing, I made a simple example that functions the same as your flash movie (x opens a window) and I used the same javascript function to open the window as you have on the site (pic1()). When the popup closes, it reliably gives focus back to the flash movie so the keyboard input will work.

  6. #6
    Member
    Join Date
    Jan 2002
    Posts
    82
    Thank you so, so, so much.

    Email me if you would like a $10 amazon gift voucher, you've done so much to save my project, thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center