Bill
Bill

Reputation: 19268

as3 bitmap repeat-X and repeat-Y

Quick question on Bitmap repeat x and y, i tried the following and it doesn't work

mySprite.graphics.beginBitmapFill(myFill);
mySprite.graphics.drawRect(-5, -5, 10, 10);
mySprite.graphics.endFill();

is it because you need to have a matrix

public function beginBitmapFill(bitmap:BitmapData, matrix:Matrix = null, repeat:Boolean = true, smooth:Boolean = false):void

Cheers Bill

Upvotes: 0

Views: 1268

Answers (1)

Bill
Bill

Reputation: 19268

function drawBackground():void {
    var clip:MovieClip = new GradientMovieClip();
    var bd:BitmapData = new BitmapData(clip.width, clip.height, true, 0xFFFFFF); // set the color to 0xFFFFFF if you use transparent png file for the pattern
    bd.draw(clip);
    _background.graphics.clear();
    _background.graphics.beginBitmapFill(bd);
    _background.graphics.drawRect(0, 0, widthOfTheScreen, heightOfTheScreen);
    _background.graphics.endFill();
}

Problem solved

Upvotes: 2

Related Questions