Feb 14 2009

AS3 resizable curved box with gradients

Category: ClassesHadi Tavakoli @ 10:39 pm

Have you ever wished you could have a resizable curved cornered box which you could easily change its gradient colors?! Find the new Class for this here.

well, if so, I'm sure you have tested it and have found out that creating a well shaped curved cornered box in a movieclip will not look good when you try to resize the movieclip! the corners get disordered...

download this class I wrote today (Saved in CS4), it will let you create boxes and set their size plus their gradient color easilly and add it anywhere you like :)


		  
		  
		  
		  
		  
		  
		

And here is how it may look...

When I give it a second thought, maybe we can add even more features to this simple class... but that's ok for my current use. I hope someone can find this helpful as it gives a good sample on drawing gradients and also about the logic behind how we have saved the curved corners of a box!

Here is the class for a quick review:


		  
		  
		  
		  
		  
		  
		

If you ever came up with a better version, I'd be glad to have a look also :)

Regards,
Hadi

Tags: , , , , , , , ,

One Response to “AS3 resizable curved box with gradients”

  1. Hadi Tavakoli says:

    What a fool I am! Why didn’t I used the curveTo or drawRoundRect methods??!! instead of creating all those movieclips?! well, it was a practice anyway, right? at least we learnt about gradients… and besides that, it’s a class and maybe in furure when we had more time we can upgrade our class for a better solution :) but for now, I’m still going to use the class I wrote above in our application. maybe later we change it into some better class. That’s the good thing about AS3 classes.

Leave a Reply