-
JavaScript question...
I'm looking to open a pop-up window with my website in it (which is essentially just an placeholder HTML page that has only my SWF in it... the SWF is the entire web page). Now the trick is, I already have the popo-up come up as a centered window at 800 X 600. On really high resolutions, though, the text in the SWF gets really small. Is there any way to have Javascript open the pop-up and resize automatically to %75 of the horizontal and vertical size of the user's screen resolution? Also, if I do that, is there a way to have the SWF that's embedded in the HTML page to auto-scale along with the pop-up window (the same behavior that occurs when you open an SWF file directly with Internet Explorer)?
Thanks in advance.
-
Use percentages in both the call to window.open (75%) and in the object/embed tags (100%).
-
Yeah, this is possible.
I haven't written in JavaScript in a while, so I'm not entirely sure of myself, but here goes:
<script type="text/javascript">
<!--
wWidth = (screen.width*0.75);
wHeight = (screen.height*0.75);
fileLoc = whatever.html
genWindow = window.open(fileLoc, "genWindow", 'width=' + wWidth + ', height=' + wHeight + ', left=' + ((screen.width - wWidth)/2) + ', top=' + ((screen.height - wHeight)/2));
genWindow.resizeTo(wWidth, wHeight);
genWindow.moveTo((screen.width - wWidth)/2, (screen.height - wHeight)/2);
genWindow.focus();
-->
</script>
stick that in the head of your index.html, assuming you want the pop-up to trigger immediately.
In whatever.html, change the WIDTH=### and HEIGHT=### in the <EMBED> and <OBJECT> tags to:
WIDTH=100% and HEIGHT=100% respectively.
And there you go, if all went according to plan, you have a pop-up 75% of the screen's size and a flash movie filling it, scaling with the size of the window.
If you want the flash movie to fill every damn pixel of whatever.html (the pop-up window) stick this in its <BODY> tag:
<BODY leftmargin=0 topmargin=0>
Hope I've been a help and not just confused you more :)
-
Well, I can't seem to get it to work (I'm really a newbie with script).
In my index.html, I've got a Flash button that calls this pop-up. In the button's actions, this is what I have now:
on (release) {
getURL("javascript:NewWindow=window.open('http://www.mywebsite.com/flashpage.swf','newWin','width=800,height=600,left =0,top=0,toolbar=No,location=No,scrollbars=No,stat us=No,resizable=No,fullscreen=No'); NewWindow.focus(); screen_height = window.screen.availHeight; screen_width = window.screen.availWidth; left_point = parseInt(screen_width/2)-(800/2); top_point = parseInt(screen_height/2)-(600/2); setTimeout('NewWindow.moveTo(left_point,top_point) ',100); void(0);");
}
How would I achieve what I want in this Flash button's actions?
-