4
我有一個名爲myBitmapData的BitmapData對象。它被加載了大小爲104x104的PNG。此PNG表示透明背景上的紅色圓圈。 還有一個名爲myBackground的Sprite對象。我想要將這個紅色圓圈渲染到myBackground中。Actionscript 3.0 drawRect工程奇怪
myBackground.graphics.beginBitmapFill(myBitmapData);
myBackground.graphics.drawRect(0, 0, myBitmapData.width, myBitmapData.height);
myBackground.graphics.endFill();
addChild(myBackground);
一切都很好。我在myBackground的左上角看到一個紅圈。
但是,當我改變第三行
myBackground.graphics.drawRect(0, 52, myBitmapData.width, myBitmapData.height);
,並希望我的圈子裏被52個像素向下轉換,我居然得到了一些奇怪的(對我:)):有兩個紅色半圈(它們形成像沙漏一樣)。
所以,問題是:如何將myBitmapData呈現到myBackground的隨機位置?
P.S. 在
myBackground.graphics.drawRect(0, 104, myBitmapData.width, myBitmapData.height);
的情況下,它是圓再次:)