Color Fill in Flex

May 4, 2009 at 12:08 PM | In Flex / AS, Programming | Leave a Comment
<mx:Script>
	<![CDATA[
		private function fill(event:MouseEvent):void
		{
			var data:BitmapData = Bitmap(imageObject.content).bitmapData;
			data.floodFill(event.localX,event.localY,0x00ffff);  // replace 0x00ffff with your choice of color
		}
	]]>
</mx:Script>
<mx:Image id="imageObject" source="...." click="fill(event)" />

This few lines simply fills selected or defined color to DisplayObject / Image like fill tool of any Paint tool.

No Comments Yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.