Hi, I have a major problem with loader.close(). Acording to Adobe, this
Quote:
|
Cancels a load() method operation that is currently in progress for the Loader instance.
|
The problem is I can't get this to work.
When I click green button, load content.swf
Code:
private function onGreenClick(event:MouseEvent):void
{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComp);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader.load(new URLRequest("content.swf"));
}
When I click another button, close the loading stream (stop the movie from loading)
Code:
private function loadImage():void
{
loader.unload();
try
{
loader.close();
killLoader();
trace("stream closed");
}
catch(error:Error)
{
trace("can't stop stream");
}
}
private function killLoader():void
{
trace("killoader");
removeChild(loader);
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, loadComp);
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadProgress);
}
What am I doing wrong because this is not working ?
