AS2 uniform scale on screen resize
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS2 uniform scale on screen resize

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    3

    AS2 uniform scale on screen resize

    Hi,

    I'm making a swf which resizes 100% in height and width according to screen resizing.

    Can someone help me understand how to position my instances,
    and how to rescale them uniformly.

    I'm using the listeners here below:

    resizer = function () {
    }

    resizer();

    sizeListener = new Object();
    sizeListener.onResize = function() {
    resizer();
    }

    Stage.addListener(sizeListener);

    thanks
    Xav

  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    3
    Ok, I found this code which does what I want it to do if my .mc was rectangular from corner to corner.
    But I have animated .mc which is all over the place.
    how can I use this bg_ratio also on this .mc to scale it uniformly so that it comes in from the bottom left and ends at the top right corner?

    i hope this makes sense,
    thanks
    Xav

    [HIGHLIGHT=Actionscript]
    Stage.scaleMode = "noScale"
    Stage.align = "TL";

    bg_ratio = bg_mc._width / bg_mc._height;

    stageResize();

    function stageResize():Void {
    stage_ratio = Stage.width / Stage.height;
    if (stage_ratio >= bg_ratio) {
    bg_mc._width = Stage.width;
    bg_mc._height = bg_mc._width / bg_ratio;
    } else {
    bg_mc._height = Stage.height;
    bg_mc._width = bg_mc._height * bg_ratio;
    }
    }

    var stageListner:Object = new Object();
    stageListner.onResize = function():Void {
    stageResize();
    };

    Stage.addListener(stageListner);
    [/HIGHLIGHT]

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

Poll by Flashkit.com