Monday, July 06, 2009

Bhut Jolokia Brownies

Hot on the heels (as it were) of releasing "Holy Jolokia," a hot sauce made with Bhut Jolokia, the NMSU Chile Pepper Institute is now selling Bhut Jolokia in powdered form. It's a boon to chefs everywhere who like their food spicy.

(For those of you who don't know, the Bhut Jolokia is the world's hottest pepper, rather recently discovered, whose heat goes into the millions of Scovilles.)

To celebrate, my wife made a whole tray of brownies with only a teaspoon of powdered Bhut Jolokia mixed in. And boy, did it add some zip! Not enough to be painful, but certainly enough to give you a pleasant chile burn for a while. If you're looking for a way to add a little zing to your cooking, just a little bit of this stuff will go a long, long way!

(Cue jokes about putting mind- and body-altering substances in brownies...)

Thursday, July 02, 2009

Preloading Flash SWF's without Executing Scripts

For a project we are doing at work, I had a game engine shell which would load .SWF's into the shell for playing individual vignettes and cutscenes. Because it was going to be served via a web server, I wanted to preload these vignettes during play so that when the vignette was encountered, it would play immediately, instead of the user having to wait to download the item.

However, one of the vignettes had a custom cursor in it, which would hide the regular cursor. The end result of this was that when I preloaded that SWF, it would execute that code and hide the cursor for the movie before displaying that vignette.

The solution was to use URLLoader to load the vignettes to get them into Flash Player's cache, and then, when they were needed, using the Loader class to load them into the engine:
public class SWFPreloader {
public function SWFPreloader() {
// Preload a list of SWFs here, or call preloadSWF()
this. preloadSWF( 'intro' );

public function preloadSWF( url:String ) {
var urlr:URLRequest = new URLRequest( url );
var _loader:URLLoader = new URLLoader();
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.load( urlr );
Using this method, you could preloadSWF() the MovieClips you will need later, and the Flash Player will put them into the cache. Load the MovieClips normally using the Loader() class, and Flash Player will pull the SWF's from the Flash Player cache instead of downloading them again from the web server.