Re: How do I create a liquid smooth scalable bitmap background?

Hi,

I’m trying to mimic the behavior of the http://www.interpolnyc.com/ where the bitmap in the background scales smoothly to the browser size but the other elements don’t move. i was able to make a .swf where the image tiled as the browser scaled but i don’t want this. i want one bitmap to smoothly scale as the other elements remain fixed.

I know i need to adjust the fillBG function, any help is much appreciated!

Here’s my code:


import flash.display.BitmapData;
    text._x = 400;
    text._y = 100;
    
var hurricane:BitmapData = BitmapData.loadBitmap("hurricane");

function fillBG(){
    this.beginBitmapFill(hurricane);
    this.moveTo(0,0);
    this.lineTo(Stage.width, 0);
    this.lineTo(Stage.width, Stage.height);
    this.lineTo(0, Stage.height);
    this.lineTo(0,0);
    this.endFill();
}

fillBG();

var stageL:Object = new Object();

stageL.onResize = function(){
        fillBG();
        text._x = 400;
        text._y = 100;
}