scaling up stage in Action Script 3.0
Copy link to clipboard
Copied
Halo.
Is there any way to scale up stage according to user's screen resolution?
because:
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
and width: 100% in html document
doesn't work when screen is widther than flash site.
I managed to size up stage in AS2 but I have no idea how to do that in AS3.
Any ideas?
Copy link to clipboard
Copied
you don't want to scale up to the screen resolution because the browser window will be smaller. use javascript to determine browser window size, the externalinterface class to retrieve that data and then size use:
MovieClip(root).width=bw;
MovieClip(root).height=bh
or just use scalemode exactfit or noborder or showall.
Copy link to clipboard
Copied
Ok. I've used java script and stored the viewport width and height in the variables viewportwidth and viewportheight
Could you please help me with the externalinterface class to retrieve those. I will appreciate any guidelines.
Copy link to clipboard
Copied
in your flash:
import flash.external.ExternalInterface:
ExternalInterface.addCallback("yourjsF", f);
function f(w:Number,h:Number){
trace(w,h);
}
and in your html between script tags:
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
function whateverF() {
thisMovie("put the name of your swf here").yourjsF(viewportW,viewportH); //<=this (swf name) is the part most people screwup
}

