Unfortunetly it don't work. In the code I marked the place where error occurs.
It's the part when I try to create bitmapData from width and height of the image_temp
bitmapData=new BitmapData(image_temp.width, image_temp.height);
The error says ArgumentError: Error #2015: Invalid BitmapData.
So I think I'm doing something wrong, but I don't know what, and how to fix this.