On Air Tour Europe 2008… le drame [fr] De la méthode GQM, Goal-Question-Metric [fr]
Mar 13

I needed a canvas with customizable background colors. I found a few examples and sources on the web but I was not satisfied enough with them, so I decided to build my own one.

GradientCanvas extends mx:Canvas by creating a customizable background gradient of colors. The class adds styles to the mx:Canvas and has a simple structure as it draws a rounded rectangle in the overriden updateDisplayList() function. This allows to take advantage of both beginGradientFill and drawRoundRectComplex options: type of gradient, ratios, rotations, offsets, corner radius settings…)

As a demo, I provide a specific style explorer that generates the CSS styles or MXML declarations for your own use.

You can get a demo of my GradientCanvas here.

The version 2 of this component  is available here

ColorPickers are those of Yahoo Astra (under BSD licence).

I would be pleased to get feedback on this component, comments on the code or any suggestion of improvement Big Grin.

This is the first version of my GradientCanvas. For the v2, I would like to build a multi-gradient background and play with borders and maybe with backgroundImage, so stay tuned if you like this v1 ! Wink

Flattr this 

Related posts

Written by Arnaud
Creative Commons License
Tags: ,

Share/Save/Bookmark

Help me improve my blog by rating this post or sending a comment.

not goodquite goodgoodvery goodexcellent (7 votes, average: 5 out of 5)
Loading ... Loading ...


Comments