Skip to content

Instantly share code, notes, and snippets.

@marchbold
Last active January 23, 2020 22:48
Show Gist options
  • Save marchbold/b468f6986a7d08831117 to your computer and use it in GitHub Desktop.
Save marchbold/b468f6986a7d08831117 to your computer and use it in GitHub Desktop.
Using the Share ANE to share a file
if (Share.isSupported)
{
Share.service.addEventListener( ShareEvent.COMPLETE, share_shareHandler );
Share.service.addEventListener( ShareEvent.CANCELLED, share_shareHandler );
Share.service.addEventListener( ShareEvent.FAILED, share_shareHandler );
// Here we have packaged a file "TestDocument.pdf" in an "assets" folder in our AS application project
var path:String = File.applicationDirectory.nativePath + File.separator + "assets" + File.separator + "TestDocument.pdf";
Share.service.shareFile( path, "TestDocument.pdf", "application/pdf" );
}
...
private function share_shareHandler( event:ShareEvent ):void
{
trace( event.type + "::" + event.activityType + "::" + event.error );
}
// com.distriqt.Share
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment