Search Tutorials
Opening a cool pop up window 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) { 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"> 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
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|