as3位图repeat-X和repeat-Y

时间:2012-06-19 06:12:06

标签: actionscript-3

关于位图重复x和y的快速问题,我尝试了以下内容并且它不起作用

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

是因为你需要一个矩阵

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

干杯 比尔

1 个答案:

答案 0 :(得分:2)

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();
}

问题解决了