Skip to main content
Participant
January 12, 2012
Question

Loader locks images it has loaded

  • January 12, 2012
  • 1 reply
  • 1284 views

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.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
January 12, 2012

are you trying to edit the image while it's open in your swf?

gggsonAuthor
Participant
January 13, 2012

Yes that is correct.

I am trying to edit the image somewhere else while the swf stays open with the image being displayed in the swf.

Date: Thu, 12 Jan 2012 07:50:35 -0700

From: forums@adobe.com

To: johnson_shih@hotmail.com

Subject: Loader locks images it has loaded

Re: Loader locks images it has loaded created by kglad in Action Script 3 - View the full discussion

are you trying to edit the image while it's open in your swf?

Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:

To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.

Start a new discussion in Action Script 3 by email or at Adobe Forums

For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

kglad
Community Expert
Community Expert
January 13, 2012

i don't think there's a work-around and i can't see any purpose.  why do you want to do that?