I'm trying to draw an image in actionscript, I set it as a BitmapFill within a rectangle. The problem is that if I move the rectangle away from the origin(0,0), in my case I start drawing the rectangle at (20,35), the bitmap background doesn't follow along. The background is always drawn at (0,0) and then repeated, so I don't get a centered image but rather 2 halved images. Here's what my code looks like:
public class PageTileRenderer extends VBox
{
private var sp:Shape;
[Embed(source="../../../../assets/content.png")]
private var contentIconClass:Class;
private var contentIcon:Bitmap = new contentIconClass ();
// ...
private function drawIcon():void{
sp.graphics.beginBitmapFill(contentIcon.bitmapData);
sp.graphics.drawRect(20, 35, 13, 13);
sp.graphics.endFill();
}
}
So my question is how to move the background fill origin. Or is there another solution to draw the image centered.
Thanks in advance for your help.
contentIconClass();
contains what? – Benny