开发者

How to set Bitmap image in Canvas background? AS3

I have image as Bitmap:

var bitmapImage:Bitma开发者_开发百科p=getDefaultImage();

I need to set this bitmap as canvas backgroundImage.

I find method

  myCanvas.setStyle("backgroundImage",url); 

But i dont need url. Whent i do this:

myCanvas.setStyle("backgroundImage",bitmapImage);

I have an error.

How to set bitmap image in canvas background?


I am not sure if this is possible... You see, setStyle and getStyle in AS3.0 both work on CSS base. And in CSS there is nothing like Bitmap, just URLs, URIs, numeric, string and type values... Nothing for byte data.

So - either you use your Canvas wrong (don't use it at all maybe?), or, if you really need to use the setStyle method for this, you will have to use the URL... However, I think it might be possible to embed the file into the SWF... Not just with the Embed directive, but something like Flex project. It might be possible to address the file with local URL such as "myBitmap.png".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜