Loader locks images it has loaded
Hi
I am trying to create a simple flash that loads an image from my HardDrive. The following is my simple program:
package {
import flash.display.Sprite;
import flash.events.*;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.display.Bitmap;
public class Test extends Sprite {
private var imgLoader:Loader;
public function Test() {
imgLoader= new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderReady, false, 0, true);
imgLoader.load(new URLRequest("test_image.png"));
//imgLoader.close();
}
private function onLoaderReady(e:Event) {
//imgLoader.close();
var b = Bitmap(e.target.content);
b.x = 100;
b.y = 100;
addChild(b);
}
}
}
however, I have noted that while this flash is opened, even though the loader has finished loading the image and the image is currently being displayed, I can not edit the image with any other program. (It will complain that the image is currently being used by another program.)
I have found that if i use the close() function for the Loader, it will release the lock. however, if i try to close the loader in my event complete function (because i want to close the loader only after when the image has finished loading), it will complain with the following error:
Error: Error #2029: This URLStream object does not have a stream opened.
Does anyone knows how to release the lock the Loader has acquired after when the image has finished loading?
thankyou very much in advance.