tags:

views:

315

answers:

1

After some lovely help here earlier Ive almost finished the project Im working on. I thought i had it completed but Ive gone and ran into one final issue. My program takes a screenshot of the final output of my file, and the final output of my file has some linked images from URLs inside of it. Now when the images are excluded, it saves just fine, but when i load in an image from a web address it doesnt seem to allow my imageSnapShot to work.

private function takeSnapshot(even:Event=null):void {

    var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(previewMode);
    var MyFile:FileReference = new FileReference();

    MyFile.save(imageSnap.data, 'profile.png');


 }

Where "previewMode" is the component Im taking a screendump of (a viewstack) and inside there are some linked images from websites.

Through some testing it seems to stop on -

var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(previewMode);

So it isnt actually getting the image of the output. Any help would be greatly apperciated, you have all been wonderful so far.

+1  A: 

ImageSnapshot.captureImage might be using the BitmapData.draw() method to take the snap shot. The livedocs page on this method says that:

The source object and (in the case of a Sprite or MovieClip object) all of its child objects must come from the same domain as the caller, or must be in a SWF file that is accessible to the caller by having called the Security.allowDomain() method. If these conditions are not met, the draw() method does not draw anything.

Your file has some linked images from URLs inside it. Apparently that's not allowed. Check out Security.allowDomain for a possible work around. If you have external images these rules also apply.

If you load a Bitmap object from a domain other than that of the Loader object used to load the image, and there is no cross-domain policy file that permits access to the domain of the Loader object, then a script in that domain cannot access the Bitmap object or its properties and methods.

Amarghosh
This is exactly right. Since Flex 3.5 this also throws a SecurityError exception.I am trying to take a screenshot of an app based on GoogleMaps and have this same problem that I try to work around for sending error emails into my inbox (with screenshot).
motto