First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Peyman Hooshmandi Raad | Website: http://www.2advanced.4t.com
Opening a cool pop up window

 

 

 

 

 

Opening a cool pop up window

By: Peyman Hooshmandi Raad

[preview]

Sometimes the swf file is not that much big to fit the browser's window and you know how ridiculous is a 300x450 swf file inside a maximized window with toolbar, status bar, address bar, all kinds of buttons and so many other unnecessary stuffs around it. You certainly have seen those cool popup windows that exactly fit what they have inside them. I am trying to tell you the secret behind these popups, step by step. Well, It is only a small JavaScript that does everything. Let's get started.

Step 1. Create a button symbol in flash and attach this code to the instance on stage:

            on (release) {
              getURL ("JavaScript:pop();");
            }
            

This code calls a JavaScript function -pop- that is inside the html file hosting it. That means when the button is released the JavaScript function pop will be executed.

Step 2. Save your fla file and name it opener.fla. publish your file (Press F12) and open the HTML file that has just been created where you had saved the current fla file. Insert the JavaScript Code below, between the <Head> </Head> tags. 

 

  IMPORTANT NOTE : DON'T COPY AND PASTE THIS CODE. REWRITE IT.

<SCRIPT LANGUAGE="JavaScript">
function pop() {
window.open("popup.html","","height=200,width=200,left=0,top=0");
}

</script>

Step 3. Now you have your button that will open a popup window named popup.html and it is the time for you to create another HTML file named popup.html that will be opened as I mentioned above. Ok this HTML file can also contain a swf file or whatever you put inside it But this HTML file will be opened with height and width you specify in the JavaScript code. That means you have to adjust what popup.html contains with your JavaScript code.

Settings. You can adjust the popup's height (200 in the example)

               You can adjust the popup's width (200 in the example)

               You can specify the popup's position (x=0 & y=0  in the example)

Troubleshooting. The opener.swf must be executed inside it's HTML file. I mean if you simply double click the opener.swf it opens your windows flash player not the Browser's window. The second thing is that you must specify the complete address of the page you want to open in the JavaScript code for example: 

            window.open("http://www.2advanced.4t.com/popup.html", . . . .

Final Note. I have included a complete set of Source files that I myself Have created for this tutorial. You can use it in case of any misunderstanding. By the way if you have any problem creating a popup window send your question to flash5developer@yahoogroups.com and  will answer your question. 

 

GOOD LUCK

Peyman Hooshmandi raad

http://www.2advanced.4t.com

Copyright © 2000-2001 Peyman Hooshmandi Raad

 

 

 

           

        

» Level Intermediate

Added: 2001-12-15
Rating: 7.96 Votes: 125
(10 being the highest)
» Author
Nothing to say!
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.