I have a BitmapData object named myBitmapData. It was downloaded PNG in size 104x104. This PNG is a red circle on a transparent background. There is also a Sprite object named myBackground. I want to make this red circle in myBackground.
myBackground.graphics.beginBitmapFill(myBitmapData); myBackground.graphics.drawRect(0, 0, myBitmapData.width, myBitmapData.height); myBackground.graphics.endFill(); addChild(myBackground);
Everything is good. I see a red circle at the top left of myBackground.
But when I change the third line to
myBackground.graphics.drawRect(0, 52, myBitmapData.width, myBitmapData.height);
and we expect that my circle will be translated 52 pixels down, I really get something strange (for me :)): there are two red semicircles (they form an hourglass).
So the question is how to make myBitmapData into a random position myBackground?
PS In the case of
myBackground.graphics.drawRect(0, 104, myBitmapData.width, myBitmapData.height);
rounded again :)
source share