Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

scaling up stage in Action Script 3.0

Explorer ,
May 09, 2010 May 09, 2010

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?
TOPICS
ActionScript
668
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 09, 2010 May 09, 2010

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 09, 2010 May 09, 2010

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 09, 2010 May 09, 2010
LATEST

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

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines