# Problem with Fill bg and BitmapData

**URL:** <https://forum.kirupa.com/t/problem-with-fill-bg-and-bitmapdata/253253>\
**Category:** flash\
**Created:** [February 28, 2008, 4:11pm UTC](https://forum.kirupa.com/t/problem-with-fill-bg-and-bitmapdata/253253 "2008-02-28T16:11:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gernouille](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@Gernouille](https://forum.kirupa.com/u/Gernouille)\
**Post date:** [February 28, 2008, 4:11pm UTC](https://forum.kirupa.com/t/problem-with-fill-bg-and-bitmapdata/253253/1 "2008-02-28T16:11:40Z")

</div>

Hi, I’m attending to do a fill background when the web page resize with a bitmap tile.

I’ve achieved to do one with a vector graphic (draw by Flash), following this tutorial ([http://www.senocular.com/pub/kirupa/as3tips\_p8.html](http://www.senocular.com/pub/kirupa/as3tips_p8.html))

```auto
mport flash.display.BitmapData;
import flash.geom.Rectangle;

var square:Rectangle = new Rectangle(0, 0, 10, 10);
var tile:BitmapData = new BitmapData(20, 20, false, 0xFFFFFF);
tile.fillRect(square, 0xFF0000);
square.x = 10;
square.y = 10;
tile.fillRect(square, 0xFF0000);

this.graphics.beginBitmapFill(tile);
this.graphics.lineTo(this.stage.stageWidth, 0);
this.graphics.lineTo(this.stage.stageWidth, this.stage.stageHeight);
this.graphics.lineTo(0, this.stage.stageHeight);
this.graphics.lineTo(0, 0);
this.graphics.endFill();

```

When I’m attending to replace the vector graphic by mi image (gif), the script don’t work anymore. Here is the tutorial I’ve followed

```auto
import flash.display.BitmapData;
var tile:BitmapData = new MyImage();
this.graphics.beginBitmapFill(tile);
this.graphics.lineTo(this.stage.stageWidth, 0);
this.graphics.lineTo(this.stage.stageWidth, this.stage.stageHeight);
this.graphics.lineTo(0, this.stage.stageHeight);
this.graphics.lineTo(0, 0);
this.graphics.endFill();

```

Well, I don’t know if any of you see what is not working in my code. Any help would be much appreciated

[Here is the FLA](http://gernouille.spymac.com/dropzone/fillBG_tile.fla.zip)
