I’ve seen a lot of posts on how to tile an image in a Flash movie that is being scaled to fit the browser. I found some code posted a while back to do it in MX 2004. (below) Can someone tell me what parts of this don’t work in Flash MX? (I don’t have 2004) Can this be adapted to work in Flash MX, or does someone know another way to achieve the desired result in MX?
Stage.align = "LT";
Stage.scaleMode = "noScale"; // prevent content being scaled
backgroundClip.makeBackground = function() { // build a background from the tile clip to fill the screen
var tileWidth = 138; // the dimensions of your background tile
var tileHeight = 138;
var cols = Math.ceil((System.capabilities.screenResolutionX - 20) / tileWidth);
var rows = Math.ceil((System.capabilities.screenResolutionY - 20) / tileHeight);
var depth;
for (var i = 0; i < cols; ++i) {
for (var j = 0; j < rows; ++j) {
depth = this.getNextHighestDepth();
this.attachMovie("bg", "bg" + depth, depth, {_x: i * tileWidth, _y: j * tileHeight});
}
}
}
backgroundClip.onResize = function() { // reposition the background as the stage resizes
this._x = (Stage.width - this._width) / 2;
this._y = (Stage.height - this._height) / 2;
};
Stage.addListener(_level0.backgroundClip);
_level0.backgroundClip.makeBackground();
_level0.backgroundClip.onResize();
Thanks,
mfrederickson