Ok, so seems like some folks understand how the java works for poping a new window out of Flash and some still don't. Thought I would take everyone through the code and try to explain what each piece is and how it is used.
AGAIN, thanks go to the good folks at http://www.polar-lights.com who provided the base code for me to pass on here. :)
Browsers
I have tested these window methods on:
- IE 5.0 and 5.5
- Netscape 4.7
- Windows and Mac
The Code
You are using a getURL command to call a javascript function: window.open
getURL ("javascript:window.open('FileName','WindowName',' Variables'); void(0);");
}
FileName
Your file name is the name of the HTML, executable, or other file that you want to open in your window. Usually it is an HTML file. The file either needs to be an Absolute Reference - http://www.yoururl.com, or it needs to be a file residing in the same directory as your base file.
getURL ("javascript:window.open('http://www.flashkit.com','WindowName','Variables'); void(0);");
}
or
getURL ("javascript:window.open('myurl.html','WindowName' ,'Variables'); void(0);");
}
WindowName
Your window name is the named reference for the window that you will open. The only restriction that I know if here is the name cannot contain any spaces. So if your window is to be named "Welcome to Flashkit", you would put "WelcometoFlashkit", or "Welcome_to_Flashkit". The window name can be used to control the window and send commands to that window.
Variables
Your variables are your window height, width, and controls. The variables are listed separated by commas and no spaces. The variables that I am aware of that can be set are:
- height=### - denotes the height of the window in pixels.
- width=### - denotes the width of the window in pixels.
- toolbar=yes/no - denotes if there will be a toolbar on the newly opened window. Set this to yes if you want one - no if you don't.
- menubar=yes/no - denotes if there will be a menubar. Set this to yes if you want one - no if you don't.
- scrollbars=yes/no - denotes if there will be scrollbars or not. Set this to yes if you want one - no if you don't.
- resizable=yes/no - denotes if the user can change the size of the window by dragging on the lower right corner or not.
- location=yes/no - The location bar is the space at the top of the browser window where the page URL is displayed.
- directories=yes/no - This is the bar at the top of the browser window that has the bookmarks and such.
- status=yes/no - The status bar is the area at the very bottom of the browser screen that tells you "Document Done".
- left=### - This positions the window a certain number of pixels from the left side of the screen.
- right=### - This positions the window a certain number of pixels from the right side of the screen.
void(0);");
The void statement keeps the browser from corrupting or changing your base window - and we put it there because Illya from Polar-Lights says we have too! :)
Put it together
These examples are Flash 5, but the concept is the same for Flash 4, just slight differences in syntax:
300x400 window with toolbars, scrollbars, and status:
on (release) {
getURL ("javascript:window.open('http://www.flashkit.com','Welcome_To_FlashKit','width=300 ,height=400,top=0,left=0,toolbar=yes,scrollbars=ye s,resizable=no,menubar=no,status=yes,directories=n o,location=no'); void(0);");
}
600x800 window with toolbars, menubar, resizable, set 50 pixels from the left edge and 100 pixels from the top
on (release) {
getURL ("javascript:window.open('http://www.flashkit.com','Welcome_To_FlashKit','width=800 ,height=600,top=100,left=50,toolbar=yes,scrollbars =no,resizable=yes,menubar=yes,status=no,directorie s=no,location=no'); void(0);");
}
[Edited by GreatGooglyWoogly on 02-15-2001 at 05:47 PM]
