10 Aug
Full Browser/Full Screen Flash
The code for full screen/full browser is really simple. In fact, the only code that is needed is to make sure that the objects within the SWF itself does not scale - and a line of code to align it to the Top Left of the browser.
[code lang="actionscript"]
Stage.scaleMode = “noScale”;
Stage.align = “TL”;
[/code]
The rest depends on your publish settings(Ctrl + Shift + F12). What you need to do is to set the width and height to 100 Percent. Remember to change the dimensions to percentage.
I’ve attached a file, which I don’t remember where I got from. =x
The code features a onResize Handler, which is important for full screen flash as well. This is because you need this listener to check if the user resized the browser, then change the positions of the elements in the SWF accordingly.
The flash file contains the HTML, the SWF, and the FLA file for this. In the center, is a text field containing the dimensions of the Flash. Open the index.html and try resizing the browser, and you will see that the text field will always be in the center. This is done by adding lines of code to set the _x and _y of the text field within the onResize handler.
[code lang="actionscript"]
this.onResize = function() {
//– Called when browser is resized.
this.txtDimentions._x = (Stage.width/2)-(this.txtDimentions._width/2);
this.txtDimentions._y = (Stage.height/2)-(this.txtDimentions._height/2);
this.txtDimentions.text = Stage.width+”x”+Stage.height;
};
[/code]
I hope you guys enjoyed this little tutorial. A lot of people have asked me how I did QwertyDesign, and well, here is the base of what started QD.net.
Project Files: FullBrowserFlash






Recent Comments