Difficulty: Intermediate
Software Environment : Flash 4 or 5, NS or IE 4 or higher.
We have a lot of requirements in this example, but I'm not a javacscript programmer, so I asked people to do it in a Web page. Most people think the full-screen screen is annoying, so we've come up with a lesson: never implement it when you don't need it, because it's annoying, isn't it? All right, let's go.
We want to paste the code into our HTML file. I made minor changes to this code to allow us to do this.
Many of the messages I receive often contain the following two common errors:
- When you publish an HTML file in Flash, you overwrite the contents of the previous HTML file, so you publish the HMTL file and then paste the code.
- If there is no effect, clear the temporary files in IE.
- If you use an Apple browser, check the bottom of the page for a note.
You need to do two simple steps to get the Full-screen window to pop up:
- Copy and paste the following code between the
<script language= "JAVASCRIPT" > <!--
function Detectversion () { Version = parseint (navigator.appversion); return version; } function Detectos () { if (navigator.userAgent.indexOf (' Win ') = = 1) { OS = ' Macintosh '; } else { OS = ' Windows '; } return OS; } function Detectbrowser () { if (navigator.appName.indexOf (' Netscape ') = =-1) { Browser = ' IE '; } else { Browser = ' Netscape '; } return browser; } function fullscreen () { var adjwidth; var adjheight; if ((detectos () = = ' Macintosh ') && (detectbrowser () = ' Netscape ')) { Adjwidth =; Adjheight = 35; } if ((detectos () = = ' Macintosh ') && (detectbrowser () = ' IE ') { Adjwidth =; Adjheight = 35; Winoptions = ' fullscreen=yes '; } if ((detectos () = = ' Windows ') && (detectbrowser () = ' Netscape ')) { Adjwidth = Adjheight = 30; } if (Detectversion () < 4) { Self.location.href = ' oldbrowser.html '; } else { var winwidth = Screen.availwidth-adjwidth; var winheight = screen.availheight-adjheight; var winsize = ' width= ' + winwidth + ', height= ' + winheight; var Thewindow = window.open (' windowversion.html ', ' windowname ', winsize); Thewindow.moveto (0,0); } } function Makeitso () { if ((detectos () = = ' Windows ') && (detectbrowser () = = ' IE ')) { window.open (' thefullscreen.html ', ' windowname ', ' fullscreen=yes '); } else { Onload=fullscreen (); } } -->
</script>
|
- Change the following two lines of HTML file for the window you want to pop up.
var Thewindow = window.open (' windowversion.html ', ' windowname ', winsize); --Line 50
and
window.open (' thefullscreen.html ', ' windowname ', ' fullscreen=yes '); --Line 56
- Changing the following file is a question that prompts you to have an older browser version. (Translator: Basically no use, ignore it)
self.location.href = ' oldbrowser.html '; --Line 46
- Create a button in your Flash file and add the following action:
On (release) {
GetURL ("Javascript:makeitso ()");
}
Notice that the Full-screen window we need to eject is implemented in JavaScript. If you need to implement a different button by defining variables to achieve a full screen of different windows, this tutorial will not be written, if you need to, to the forum, we will help solve.
Appendix:
How to achieve a full-screen effect without a scroll, it's easy to set the scroll bar to None, as follows:
<body bgcolor= "#FFFFFF" text= "#000000" scroll= ' no ' >