Letting players capture screenshot of the Flash virtual world can further increase the exposure of the virtual world.
Facebook requires every application to grant permission from users in order to upload photos. We had granted the permission publish_stream
from users in the news feed example. The publish_stream
also includes the permission of uploading photos and videos so that we do not need to grant extra permission again in this example.
The Flash player environment limits the file access. We cannot save the encoded JPEG directly into the filesystem from the Flash player in the browser. Instead, we will directly post the encoded JPG binary data to Facebook by the UploadPhoto
command. We format our name to the current time so that the filenames will not be conflicted with each other.
private function uploadScreenshot(e:MouseEvent) { var jpgSource:BitmapData = new BitmapData (stage.width, stage.height); jpgSource.draw(stage); var jpgEncoder...