dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: rescale stage with browser window

  1. #1
    graphic designer
    Join Date
    Aug 2002
    Location
    Brazil
    Posts
    112

    rescale stage with browser window

    How can I auto scale the stage of my movie according with my browser window... and then this (browser window) is rescaled too.
    But only the stage may be scaled, because the contents may not be stretched.

    I accept tips with javascript coding.

    Thanks
    |calve|brazil|

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    First make sure your html publish settings for the movie are set to percentages, then at the start of your movie add the lines,

    code:

    Stage.scaleMode = "noScale";
    Stage.align = "LT";



    the scaleMode will prevent items on the stage being scaled when the movie is resized, the align part means that all positions will be based from the top left hand corner of the stage.

    Now you can use the onResize event of the stage object to control how items are positioned and/or resized when the stage is resized, for example you could fix a movie clip at the bottom right corner of the stage something like this,

    code:

    myClip.onResize = function() {
    this._x = Stage.width - this._width - 5;
    this._y = Stage.height - this._height - 5;
    };
    Stage.addListener(myClip);



    a movie clip could be made to fill the entire stage like this,

    code:

    bgClip._x = bgClip._y = 0;
    bgClip.onResize = function() {
    this._width = Stage.width;
    this._height = Stage.height;
    };
    Stage.addListener(bgClip);



    note both the above examples assume the registration point for the movie clips are in their top left hand corner.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center