How to exit a Flash SWF and HTM file together

By Beveronius

Rate: (2 Ratings)

Do you have an HTM file that calls a SWF that just won't close? If you are like me, then there is a good chance that you have created a CBT (Computer Based Training) course in Flash that has an exit button. However, when you publish the SWF and run the HTM file, the exit button does not actually close down the browser window or the movie encased inside. This tutorial will teach you just how simple this can be.

Instructions

Difficulty: Moderately Challenging

Things You’ll Need:

  • a knowledge of Flash (this tutorial assumes intermediate experience in this Adobe product)
  • a knowledge of HTML (enough to make minor changes)

Step1
Open your source FLA or Flash file and, if you have not already, save it as a recognizable name. Keep in mind that this file will be referenced later.
Step2
Create a button instance with at least an up and down state.
Step3
As the Action for this new button, type the following three lines:
1.) on (release){
2.) get URL("NAMEOFFILE.swf");
3.) }
Step4
Publish your FLA file - Shift + F12 will publish, but BEFORE you do, ensure that your publish settings dialog box accessed from the File menu has the SWF and HTML files/options selected - so that these files are auto-published.
Step5
Navigate to your save location and open the HTML file that you just published in step 4.
Step6
In the HTML file, in the BODY tag, add the following: onUnload="top.close()"

Tips & Warnings

  • When naming files, such as in step 1 above, be sure to follow UNIX naming conventions - not required, but a good idea
  • Watch out for semicolons and quotes - they will get ya every time!

Resources

Comments

| View All Comments
Flag This Comment

on 4/21/2008 Hi i just wanted to let you know that you can controle a object in the first frame like with your button(we will give it the instance name "sally"):
this.sally.onRelease = function ()
{
get URL("NAMEOFFILE.swf");
};

View All

Post a Comment

POST A COMMENT

Request a New How-To Article

Looking for more How To information? Chances are there’s an eHow member who knows how to do what you’re looking to do. Submit an article request now!

eHow Article:  How to exit a Flash SWF and HTM file together

eHow Member: Beveronius

Beveronius

Authority Authority | 3570 Points

Category: Computers

Articles: See my other articles

Related Ads