Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: Call to close browser window
From: Colin Moock
Date: Tue, 01 Dec 1998 19:18:37 +0000 (GMT)

flasheratshocker [dot] com,Internet writes:
>Hi There,
>I have a flash 3.0 movie that runs in a small JavaScript pop up window.
>When the flash movie is done, I would like to make a call to
>automatically close the window. Does anyone have a script that I can use
>in Flash to achieve this goal?

If you're working in flash, you have to be careful because you can't use the
normal "javascript:self.close()" approach without excluding IE3. I have a
tutorial on a good workaround at:
http://colinmoock.iceinc.com/webdesign/flash/closewindow/

Here's what it says:

Closing a window

Description:
Once you have created a secondary
window, you will eventually want the user to
be able to close it and return to the main
window or leave the site. Thankfully you'll
spend less time with closing a window than
you did with opening it. We face essentially
the same issue when closing a window as
we do when opening it: how do we send
commands from Flash to JavaScript
without excluding some browsers? The
best approach is, predictably, the same for
closing a window as it is for opening it--we
call normal HTML documents from Flash
using the stable and fully supported
"GetURL" action, and we rely on those
HTML documents to initiate our
JavaScript.

How To
To close a window you only need to do 2
things: 1) make a window closing page, 2)
link to the window closing page. Here's
how:


Step 1)
First, we make a page which, when loaded, runs a simple
built-in window-closing JavaScript function. Here's the code:

<HTML>
<HEAD><TITLE>Window Closer</TITLE></HEAD>
<BODY ONLOAD="self.close()">
</BODY>
</HTML>

The "ONLOAD" attribute of the body tag is a JavaScript
event handler which tells the browser to execute the
javascript contained in quotes ("self.close()"--the value of
the ONLOAD attribute). The "self.close()" statement tells
the browser to call the "close()" function of the current
browser window ("self"), which closes the window. Copy
the above code and save it as window-closer.html.


Step 2)
Whenever you want to close the
window, just link to the
window-closer.html page using the
"GetURL" action of a button or frame in
Flash, or using a standard HTML
Anchor tag (eg. < A
HREF="window-closer.html">).

------------------------------------------------------------------------
To UNSUBSCRIBE send: unsubscribe flasher in the body of an
email to list-manageratshocker [dot] com. Problems to: owneratshocker [dot] com
N.B. Email address must be the same as the one you used to subscribe.
For info on digest mode send: info flasher to list-manageratshocker [dot] com



Replies
  FLASH: Call to close browser window, Steve Guluk

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]