The short answer: Yes and no.
Or slightly more accurately, No and yes.
Confused? As was I. On to the long answer (don’t worry, not as long as is usual for me):
The addition of the close method on the Loader class is pretty great. We can now finally stop a load in progress if, for whatever reason, we deem it necessary. Maybe the user changed her mind and clicked another button while one SWF (no longer needed) was loading. Maybe we want to do something tricksy like start loading an asset, but not fully, to get the bytesTotal.
MovieClipLoader in AS2 had unloadClip, and you could interrupt a load in progress by telling it to load a non-existant URL into the same clip…but this is agreeably messy. So hurrah for Loader.close!
Except…if you try it out, it most likely won’t work. Create a simple test FLA with a clip set to be a button, called “btn_mc” and add the following code to the first frame:
var l:Loader = new Loader();
addChildAt(l, 0);
l.load(new URLRequest("path/to/some/large/asset.swf"));
btn_mc.addEventListener(MouseEvent.CLICK, doit);
function doit(me:MouseEvent):void {
trace('doing it');
l.close();
}
Now test the SWF, and then enter bandwidth simulation mode (press Command/Control-Enter again), and while the asset is still loading, click the button. But wait for it…and you’ll see it show up anyway? Wisconsin Tourism Federation? (work out the acronym…)
This is the “no” in the “no and yes” answer. I put the “no” first because this is likely the first thing you’ll try when working with Loader.close. So what about that “yes?” Is there some extra step to take? Some undocumented feature to enable?
No, it’s even simpler than that. You need to load your asset from a server.
Replace the “path/to/some/large/asset.swf” with “http://some.domain/path/to/some/large/asset.swf” and you should be good.
Needless to say, this can be the source of confusion. I don’t know what makes an HTTP stream different from a local file stream, but I concede that there are differences and that that probably accounts for this behavior. But it sure would be great if this behavior were mentioned in the documentation. It would be even better if this method just worked. Why can’t we close a Loader when loading an asset locally? This is how 99% of our development takes place; we almost always use a relative path to the asset, and we almost always develop on our local boxes without worrying about servers initially.

