Not sure what I’m doing wrong here. It will tile when the page loads, but won’t re-tile when the browser is resized.
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.Bitmap;
import flash.geom.Rectangle;
import flash.events.*;
public class Index extends Sprite {
private var backGround:Sprite;
public function Index():void {
init();
}
private function init():void {
tileBG();
stage.addEventListener(Event.RESIZE, tileBG);
}
private function tileBG(e:Event = null):void {
var oldTile:Sprite = backGround;
backGround = new Sprite();
backGround.graphics.beginBitmapFill(new Tile(0, 0));
backGround.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
backGround.graphics.endFill();
addChild(backGround);
if (oldTile != null && oldTile != backGround) {
removeChild(oldTile);
}
}
}