I need to move a ring with a solid border over an an image. I figured I would make the ring's inner area transparent using the bitmap.threshold() method a开发者_StackOverflownd move it over the image. However the threshold() method's sourceRect parameter is a Rectangle and I need mine to be a circle.
This is the method:
**public function threshold(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, operation:String, threshold:uint, color:uint = 0, mask:uint = 0xFFFFFFFF, copySource:Boolean = false):uint**
Is this the correct way to do this or is there some other method.
Thanks
You can make the non-masked regions complete transparent by setting their alpha's to 0. Colors in Actionscript can be represented as 4 byte (32 bit) values, the first byte (or was it the last?...) contains the alpha value. If you set this to 0, Flex will consider the portion with that color to be completely transparent.
So you can create a transparent rectangle and put a solid circle inside of it. Then you can just move this rectangle over your image. I believe there is no need to call the threshold function if you do this.
精彩评论