Blobby objects in Flixel

In an attempt to get familiar with Flixel 2.5, I decided to create a very basic 2d metaball thing.

Metaballs are the classic blobby/soft object simulation, and were developed in the early 1980’s to model soft blobby objects that merge together smoothly – like snow or water. These types of object interactions are intractably difficult using straight-up polygon modelling.

“Proper” metaballs involve a bunch of particles, associated density functions, and a way of extracting the isosurface, such as marching cubes, marching tetrahedra or raymarching. This micro-demo does none of these things.

Nevertheless it is conceptually the same, in 2D, except using blur operations to emulate the density functions and using alpha-thresholding to emulate extracting an isosurface and re-rendering.

The code is all available on GitHub, at


Loader.contentLoaderInfo not updating properly on cross-domain requests

This is a Flash problem that is incredibly frustrating – partly because it is completely undocumented in the AS documentation, and partly because once you know what the problem is, it is suddenly very easy to search for.

On cross-domain requests using flash.display.Loader, the contentLoaderInfo.bytesLoaded and contentLoaderInfo.bytesTotal were returning garbage, breaking my fancy loading progress bar. Completion events were firing correctly, so the app was still working, however we’re talking about 5-8 MB of data, and nobody wants to stare at a blank progress bar.

And, of course, it was only happening on the production platform – the one with the separate App, Static and DB servers.

After mucking around with SecurityDomains, crossdomain.xml tweaks and other things, it turns out that Flash (at least up to version 11) chokes completely when loading from external URLs, when the response is GZip encoded. Luckily, the code was loading already-compressed JPG, PNG and SWF files, for which the benefit of GZip is negligible at best.

A quick update to  our static media server’s httpd.conf to exclude .swf files from being deflated:

# Don't compress images or flash

SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|swf)$ no-gzip dont-vary

and all is right in the world.

The frustration is that searching for “cross domain contentLoader.bytesloaded fail” and various permutations retrieves zero relevant results. Once you suspect it’s GZip causing the problems the results come thick and fast.