1
votes

I have Flex application(not AIR) thats load image and perform some effects, application works well in flash builder and in the debug folder. But when I am trying to copy *.swf to another local folder, appears problems with image loading.

Can anybody help me? May be need specify some restriction or rules?

UPDATE You don't understand me, i am trying to load image from desktop using FileReference class, image shows successfully, but origBitmap after saveAsBitmap() method is null

public function loadImage():void
{
  fileRef.addEventListener(Event.SELECT, onFileSelected); 
  var textTypeFilter:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif,*.png)", "*.jpg; *.jpeg; *.gif; *.png"); 
  fileRef.browse([textTypeFilter]); 
}

public function onFileSelected(evt:Event):void 
{ 

  fileRef.addEventListener(Event.COMPLETE, onComplete); 
  fileRef.load(); 

} 

public function onComplete(evt:Event):void 
{ 
byteArr = fileRef.data as ByteArray;
ldr = new Loader();
ldr.loadBytes(byteArr);
fileRef.removeEventListener(Event.SELECT, onFileSelected);
fileRef.removeEventListener(Event.COMPLETE, onComplete); 
callLater(show);
} 

public function show():void
{    
 currImg.source = ldr;
 callLater(saveAsBitmap);

}
public function saveAsBitmap():void
{
 bd = new BitmapData(currImg.contentWidth * currImg.scaleX, currImg.contentHeight *  currImg.scaleY,true);
 bd.draw(currImg as IBitmapDrawable);
 origBitmap = new Bitmap(bd);
 }

//.....

<mx:Image id="currImg"/>

//.....
2
Show some code. Are your images embedded? Or are you loading them via a URL? What makes you think this is immediately a security sandbox issue?JeffryHouser
I changed your title to more accurately reflect your actual question.JeffryHouser

2 Answers

1
votes

You aren't loading images because of sandbox security errors. You will need to add a crossdomain.xml to the the server that is storing the image files.

I believe that adobe has recently loosened their crossdomain restrictions for bitmaps. However, I think you still won't be able to manipulate the bytearray data.

1
votes

Please post your code. My guess is that when you moved the swf you didn't also move your images along with it or change your code to reflect the new location. However without seeing your code there's no way for us to know.