Jump to content

Exit An Embedded Flash Movie


Guest dano24
 Share

Recommended Posts

Guest dano24

Hello,Possibly not an easy task, but I see this in sites all the time. A site intro has an swf playing with a couple of buttons that turn off the sound and enter the site if you don't want to watch the whole movie.I created an swf file with a couple of buttons. One does turn off the sound. That was straightforward. The other button does stop the movie, but it's supposed to pass control over to the page that embeds the file with a simple javascript. (it was created with CS3, a 30-day trial, now expired, scripting level @2.0) As a test, I told it to close the window. That does not happen.Then, I started looking at alternatives to closing or redirecting by clicking on various elements of my simple form. None of that works either.Details:I have a CSS that defines a region where the swf file is embedded. That region is assigned to a <div id="flashcontent"> tag.The movie is embedded by SWFObject, the Flash embed script formerly known as FlashObject. By: Geoff Stearns, @deconcept.com. This part works super great.Problem:If i try to do something like:<body> <form name="form1"> <div id="flashcontent" onclick="closewindow()"> <==== (Adding the onclick event) Code placed here to show user with Javascript turned off or no flash. </div> <!--// then the script to load/embed the swf file //--> <script type="text/javascript"> // <![CDATA[ var so = new SWFObject("myflashfile.swf", "sotester", "600", "365", "9", "#FF6600"); so.useExpressInstall('expressinstall.swf'); so.write("flashcontent"); // ]]> </script> </form></body>Of course the script for the closewindow() function is in the <head> section:<script language="javascript">function closewindow (){ window.close(); }</script>I have tried the onclick in a span tag, same no effect, and also used a <a href="#" etc, with no effect. :) Is there an easy way to either close this window, or ideally load my main site page after the button on the swf is clicked?Thank you in advance for any help with this.dano24(Desperate in Sunnyvale, CA)

Link to comment
Share on other sites

You won't be able to do anything with Javascript or HTML, a Flash document always is placed in front of any other elements on the website, even if you try absolute positioning and z-index. And it also ignores any kind of event handler you put on it.You'll have to put a movieclip in the flash document that does the commandgetURL("javascript:closewindow()");when clicked on.And add a parameter when loading the flash document: allowScriptAccess to sameDomain

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...