Edit bitmap from AS3
Copy link to clipboard
Copied
This will be my second post and the second problem
I create editable Bitmap with this code:
Everything has been very good loaded and I can see the efect in my swf. But the main thing that I want to do is fill the elements with different colors. I added listener to the stage, which has to do it, but it doesn't work:
stage.addEventListener(MouseEvent.CLICK, FillObject); function FillObject(me:MouseEvent):void{ myBitmapaData.floodFill(mouseX,mouseY,0x55cc33); }
I haven't idea what is wrong. I should reload the picture ? If somebody have any idea I will be grateful.
I found the way but it's not enough for me. I load the picture to the library and create the linkage. Than all is ok.
var myBitmapData:kolorowanka1 = new kolorowanka1(839,598); var BMP:Bitmap = new Bitmap(myBitmapData); stage.addChild(BMP); stage.addEventListener(MouseEvent.CLICK, FillObject); function FillObject(me:MouseEvent):void{ myBitmapData.floodFill(mouseX,mouseY,0x55cc33); }
But I want to load pictures from disk.
I attached rar with fla and picture.
http://www.watchtime24.sisco.pl/moje/prace/FLASH/paint.rar
Thans for all replies
Copy link to clipboard
Copied
what's the problem?
Copy link to clipboard
Copied
I don't want to have pictures in the library only load them from the disk. So the second way isn't good in may case. In the project I use the XML file and there I have path to picture.
Copy link to clipboard
Copied
what's the problem with your first snippet of code that shows loading a bitmap?
Copy link to clipboard
Copied
ok you didn't understand my problem. First code is correct, it loads the btimap, but I want fill this bitmap with the colors. I use to this floodFill() but it dosn't work in first case.
This function:
stage.addEventListener(MouseEvent.CLICK, FillObject); function FillObject(me:MouseEvent):void{ myBitmapaData.floodFill(mouseX,mouseY,0x55cc33); }
doesn't change the color of area when I click the mouse why ?
Copy link to clipboard
Copied
I found the answer ! floodFill require ARGB, so I changed color to 0xFF55cc33 and it works.
Thanks for replies
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
if you have a solution please mark as answered

