when i debuging my code via flash player’s view->emulate download ,i found that even i have call loader.close() method, the image is continue loading.
from flash 9 documentation, it said
"
close():void
Cancels a load() method operation that is currently in progress for the Loader instance.
"
but it seems not work , from view->bandwidth setting, i can see image is still loading.
anyone know why? thx.
my code is or please down source code from attachment
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.Bitmap;
var picLoader:Loader;
startload.selectable = false;
startload.mouseEnabled = true;
startload.addEventListener(MouseEvent.MOUSE_UP,startHandler);
function startHandler(event:MouseEvent):void
{
picLoader = new Loader();
picLoader.load(new URLRequest("test.jpg"));
picLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler);
}
stopload.selectable = false;
stopload.mouseEnabled = true;
stopload.addEventListener(MouseEvent.MOUSE_UP,stopHandler);
function stopHandler(event:MouseEvent):void
{
picLoader.close();
picLoader.unload();
}
function completeHandler(event:Event):void
{
var bitmap:Bitmap = event.currentTarget.content;
bitmap.width =20;
bitmap.height =20;
this.addChild(bitmap);
}