certain BitMapData types dont work in a beginBitmapFill() method.

Posted by numerical25 on Stack Overflow See other posts from Stack Overflow or by numerical25
Published on 2009-12-30T02:35:20Z Indexed on 2010/05/05 1:08 UTC
Read the original article Hit count: 340

Filed under:
|
|

Say I loaded a bitMap into a bitmapData type called tileImage.

 tileImage = Bitmap(loader.content).bitmapData;

say I decided to add that bitmap into a sprite like below

this.graphics.beginBitmapFill(tileImage );
this.graphics.drawRect(0, 0,tWidth ,tHeight );

It would of course work. But say If I decided to add tileImage into a another bitMapData type like below

var tImage:BitmapData = new BitmapData(30,30);
tImage.copyPixels(tileImage,tRect,tPoint);

and I then added tImage to my sprite

this.graphics.beginBitmapFill(tImage);
this.graphics.drawRect(0, 0,tWidth ,tHeight );

I then get the following error

ArgumentError: Error #2015: Invalid BitmapData.

tRect and tPoint are all predefined and set. tRect x and y are 0,0 and the width and height are 30x30. tPoint is 0,0 as well. Yes I understand that this is a very brief explanation but I wanted to elaborate that a bitMapdata type that has its data from the copypixel method does not work with beginBitmapFill. but a varible that gets its data straigt from the source, does. One works, and one doesnt, yet they are both the same data types. why is this ?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about bitmap