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

Problem with StageResize for a full browser site

Community Beginner ,
Jul 16, 2009 Jul 16, 2009

Hi Eone,

i'm trying to create a full stage site. I do use this code:


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

function resizeListener (e:Event):void {
trace("stageWidth: " + stage.stageWidth + " stageHeight: " + stage.stageHeight);
bG.width = stage.stageWidth;                 //mc which contains the bg image
bG.height = stage.stageHeight;

but it doesn't work . No error, no warnings. So i don't know what is the problem. It works only in the flash player (Ctrl+Enter), maybe the HTML is wrong?

TOPICS
ActionScript
734
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

correct answers 1 Correct answer

Explorer , Jul 28, 2009 Jul 28, 2009

If it works properly in the Flash IDE, it's likely a problem with the embedding html.  Did you set the width and height in the html to 100%?

Translate
Guest
Jul 16, 2009 Jul 16, 2009

When are you applying this?

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

Are you sure that "stage" is available when you set these properties and the listener? The "stage" property can be tricky...

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 ,
Jul 28, 2009 Jul 28, 2009

If it works properly in the Flash IDE, it's likely a problem with the embedding html.  Did you set the width and height in the html to 100%?

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 Beginner ,
Jul 29, 2009 Jul 29, 2009
LATEST

I had already done. Thank you anyway anyone

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
Enthusiast ,
Jul 28, 2009 Jul 28, 2009

Looks like you're close.  Try this example:

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

var bmp:Tile = new Tile(35, 35);
var tile:BitmapData = new BitmapData(35, 35);
tile.draw(bmp);


function fillBG(evt:Event = null):void {
  graphics.beginBitmapFill(tile);
  graphics.moveTo(0, 0);
  graphics.lineTo(stage.stageWidth, 0);
  graphics.lineTo(stage.stageWidth, stage.stageHeight);
  graphics.lineTo(0, stage.stageHeight);
  graphics.lineTo(0, 0);
  graphics.endFill();
};
fillBG();

stage.addEventListener(Event.RESIZE, fillBG);

This example draws a rectangle the size of the stage and fills it with with a little 35px by 35px bitmap image  I think it was a jpg it could have just as well been a gif.  (and of course you could just fill with a color) .that was converted to a symbol and given the Class name Tile.  In the publish settings in the HTML tab be sure to set dimensions to percent 100 100.  In the html set this css rule body {margin:0; padding:0; overflow:auto;}

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