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.
Read more…
In part 1, we used a DisplayObject (a Shape) for our particles. Now let’s get into single pixel particles; and go from 300 particles to 10,000 or more.
Read more…
Or, to put it another way, how to get a groovy sixties effect.
Read more…
Firstly, as i realise that i haven’t actually mentioned it yet and it’s a rather important point, PixelBender filters are quick! Much quicker than ActionScript and they can also run asynchronously in a separate thread. So bear that in mind when you find out further down the page that you can’t even loop in PixelBender!
If you’ve read part one and part two, it’s time to look at what we can do in a PixelBender kernel (filter).
Read more…
In part 1 we used PixelBender to create a custom filter. Now we can use it in Flash in the same way as any of the built-in filters.
Here is our custom filter in action:
Read more…
The built-in filters provided by the BitmapFilters API (blur, glow, dropshadow, bevel etc) are very useful but sometimes our imagination exceeds their capabilities. Wouldn’t it be nice if we could create our own? Yes it would, and it is; we can build our own filters with a free bit of software called PixelBender and use a ShaderFilter filter to implement them.
Before i go any further, here’s a simple example to show you how much further we can go with custom filters:
Read more…
As i stated in part 1, encoding a large image can take a few seconds – especially if it’s a high quality jpeg. While the encoding is running, flash player is unable to advance to the next frame so the FPS drops to zero until the encoding has finished; this means that all animations will pause and keyboard and mouse actions will be ignored – not a great user experience.
What we need to do is spread the encoding over multiple frames (known as threading), ie: enough frames so that the user doesn’t notice any slow-down.
Read more…
Categories: ActionScript, Tutorials Tags: Actionscript, AIR, Bitmap, BitmapData, Encoding, FileReference, Flash, Flex, JPEG, PNG, Threading
Since Flash Player 10, we have been able to save files directly to the users system (you could do it before, but annoyingly you had to send the file to the server and then get the server to send it back to the user – a real pain!).
Now, it couldn’t be simpler:
var file:FileReference = new FileReference();
file.save(myData, "myFileName.ext");
Read more…
Categories: ActionScript, Tutorials Tags: Actionscript, AIR, Bitmap, BitmapData, Encoding, FileReference, Flash, Flex, JPEG, PNG
This is part 2 of my summary of the flash.display.BitmapData object. If you haven’t yet, you may want to read part 1 first.
Before we get on to what i consider to be the most exciting stuff – filters – lets play with colours.
Read more…
In my previous post Bitmap Basics, i discussed creating bitmaps. This time i will go through some of the methods available to manipulate bitmap images.
Read more…