Looking for the perfect fashion jewelry piece? Check Baloka.com By Maria Mizrahi
Powered by MaxBlogPress  
  • MyLineRider

  • Flex 3 Example: Drawing a polygon at run time with adding and deleting points capability

29th August 2009

Flex 3 Example: Drawing a polygon at run time with adding and deleting points capability

I was on vacation for a couple of weeks, but I am back.

Continuing from my last example Flex 3 Example: Drawing a path at run time with adding and deleting points capabilities, I expanded the code to allow creating polygons at run time.

To create a polygon, the previous code was enhanced with graphics.endFill(); on the RedrawPath method.

I had to include additional methods to finish the polygons, as well as a method to create the last insert anchor point when finishing a polygon and more.

Below is the application to play with. To start, click on the “Add Polygon” button and then click on the stage to add points. At any time you can move any anchor (even as you are creating a polygon) to edit your polygon or any insert anchor point (light red dots) to insert additional anchor points. To end drawing a polygon click the “END” key.

Once a polygon is created in can be fully edited. Anchor points can be moved, inserted and deleted. The code is fully commented and thus I don’t go into explaining how it works in here. If you have questions post them via comments.

Get the code here.

[Post to Twitter]   [Post to Plurk]   [Post to Digg]   [Post to ping.fm]

posted in Flash, Flex | 13 Comments

  • About Me

  • Hi, I'm Gilbert Mizrahi and I created this blog to comment about technology and internet marketing. Additionally, I will post Flash/Flex experiments and in most cases they will refer to baloka.com, my wife's site- hey I have to promote the brand:)

google

google

asus