I’ve noticed that this question pops up from time to time on forums, and it’s very straight-forward to do; we can use the draw() method of BitmapData to copy any visual element (in this case, the stage itself) into a BitmapData object. Then we can use the getPixel() method to extract the colour.
You may have noticed that the frequency of posts on this blog has dropped off recently. Mainly because i have been busy with a client project, but also because i was determined to finally get a personal Flex project finished – i got a sharp reminder to get on with it when i received an email reminding me to renew the domain name for another year.
Its not totally my fault – if Adobe are going to release Spark (Flex 4 SDK) and make it much better than Halo (Flex 3) then i can hardly be blamed for wanting to completely rewrite my app (and get to grips with Spark in the process). Anyway, only one year late on delivery – not bad for an IT project – it’s finally finished.
For the un-initiated, Bezier Curves are curves defined by a set of (at least 2) points in space (usually defined by x and y coordinates). By setting appropriate sets of points, complex curving paths can easily be defined. These could be simply drawn to the screen or used as paths for visual objects (eg a game character) to follow.
The simplest case is a curve defined by 2 points – which is just a straight line. As more points are added the curvature can become more complex. The curveTo method of the Graphics class uses a Bezier Curve of 3 points (1 point defined by the current drawing position and 2 points passed into the method).
So, if we want to draw a 2 or 3 point Bezier Curve, Flash can do the work for us, but for 4 points or more we need to handle it ourselves. Also, if we are using a Bezier Curve as a path for an object to follow, we need to know the coordinates at all positions along the path and the drawing methods of Flash wont help us with that.
If you are an old codger like me, you will (fondly?) remember the sounds of early computer games. They were mostly monotone beeps and bips, but there were some real gems that took the audio experience seriously (think Defender) and used the simple audio abilities in more interesting ways.
Now, just 30 years later, Flash can also generate it’s own sound…
I have just added a new ‘stuff‘ page to this blog (see main menu above) where i will be adding assorted bits and pieces that will hopefully be useful to some of you flashers out there.
To get things started, i have added 5 PixelBender filters (when i went through my library of filters i realised that many of them were quite similar or very specific, so once i have discarded the waste i will post some more).
If you’re not familar with PixelBender, i have posted some truly amazing/totally fantastic/incredibly awesome tutorials on the subject, so there’s no excuse not to take my free stuff…