I encountered error #2148(which is security) when i was trying to load an image file.
1.If i load the swf file in local, the image s retrieved and displayed properly.
2.But if i publish the swf file into my web project and run it in localhost, it gives me #2148 security error
3.If I use http://xx.xx/ticketstub.png in loadImage() function, it works in both 1 and 2;
The problem now is when i use C:/jbdevstudio/uploads/ticketdesign/ticketstub.png it isnt working in web server.
Any idea how can i solve this or Flash simply doesnt support this. I had googled this issue for few days and try out any solutions i found but no luck still.
Thanks!
ActionScript codes:
//http://xx.xx/ticketstub.png works in both 1 and 2
loadImage("C:/jbdevstudio/uploads/ticketdesign/ticketstub.png");
function loadImage(url:String):void {
try{
// Set properties on my Loader object
imageLoader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
}catch(error:Error){
ExternalInterface.call("er", error.toString());
}
}
function imageLoaded(e:Event):void {
try{
// Load Image
imageHolder.addChild(imageLoader);
imageHolder.width = imageHolder.width / 3.5;
imageHolder.height = imageHolder.height / 3.5;
}catch(error:Error){
ExternalInterface.call("er", error.toString());
}
You cannot load an image from your local file system in Flash like this.
Images can be loaded from a web URL. If they come from a different domain to the SWF, you can only display them, not process them. However, with additional security support (proxy or crossdomain.xml) you can load images from another domain, and process them as you need.
The third option is to upload an image provided by the user through the
FileReferenceclass, however, the user selects the file, the SWF cannot select it directly. These files can be processed in any way you like.