Simple things for full-screen flash site

Who is an expert in Flash,Flex looks this article like a stupid thing but I got many questions about to create a full-screen flash site. I created this small post and hope this will help many peoples who starting to work on this issue.

First, please take a glance at this site [click here]  – the site of Billy Harvey Music and you will see it display full-screen flash whatever you re-size the browser. Creating it is very simple with a little bit of coding.

ActionScript 2.0

var centerX: Number;
var centerY: Number;

this.onResize = function() {
centerX = (Stage.width  / 2) ;
centerY = (Stage.height / 2);

Stage.scaleMode = "noScale";
Stage.align = "TL";
Stage.showMenu = false;

ActionScript 3.0

package {
import com.ostar.banner.MainBanner;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;

public class Main extends Sprite {
public var centerX: int;
public var centerY: int;

public function Main():void {
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);

private function init(e:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
this.stage.addEventListener(Event.RESIZE, resizeHandler);


private function resizeHandler(e:Event):void {
centerX = this.stage.stageWidth / 2;

centerY = this.stage.stageHeight / 2;


Once you can calculate the center point, all your instances on Stage can be located easily. Example, you can make your background – a very large picture to be aligned at center of screen.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s