Coffee Shop API: Using External Assets

Coffee Shop API: Using External Assets

One of the advantages of using the Coffee Shop API is that you can create dynamic and very lightweight files. In order to simplify the loading and the management of external images, the API provides the BitmapAssetManager class, available from the org.flashapi.coffeeshop.milling package.

By using the BitmapAssetManager class, you can easily create BitmapData instances, associate them to an external image and let the Coffe Shop API deal with the loading operations.
Thereby, you can create SWF files sized less than 10 kilobytes and fully controlled from server side. The following sample application illustrates this concept:

Get Adobe Flash player

package {
	import flash.display.*;
	import org.flashapi.coffeeshop.*;
	import org.flashapi.coffeeshop.coffeebean.*;
	import org.flashapi.coffeeshop.milling.*;
	[SWF(width='336', height='280', frameRate='30')]
	public class Main extends Sprite {
		public function Main() {
		public function init():void {
			var manager:BitmapAssetManager = new BitmapAssetManager(336, 280);
			var img1:BitmapData = manager.loadImage("img1.jpg");
			var img2:BitmapData = manager.loadImage("img2.jpg");
			var percolator:Percolator = new Percolator(336, 280);
			percolator.loop = true;
			percolator.addTransition(img1, img2, Pixelation);
			percolator.addTransition(img2, img1, Pixelation);

The Coffee Shop API should be available in the SPAS 3.0 alpha 6.1 release.
The BitmapAssetManager class will be available in the Coffee Shop API RC1.

Share this article:


There are no comments yet for this article.

Leave a reply

Your email is required but will not be displayed.

To prevent abusive emails, please enter the numbers you see in the image below:

Security code