我正在使用Android-Sharing-Extension-ANE。
如何根据我的应用程序代码共享图像?
此代码无效
var bitmap:Bitmap = ...;
// encoding image by native encoder (availible on FP 11.3/AIR 3.3 or newer)
var bitmapBytes:ByteArray = bitmap.bitmapData.encode(new Rectangle(0, 0, bitmap.width, bitmap.height), new JPEGEncoderOptions(70)));
var file:File = File.documentsDirectory.resolvePath("image_for_share.jpg");
var stream:FileStream = new FileStream(); // write file to local memory
stream.open(file, FileMode.WRITE);
stream.writeBytes(fileBytes);
stream.close();
SharingExtension.shareImage(file, "Choser title", "Message"));
答案 0 :(得分:0)
“如何与我使用Animate CC的ANE共享图像?”
摘自该ANE的“自述文件”:
使用方法:
- 将
com.illuzor.extensions.SharingExtension.ane
文件连接到您的 Android AIR项目。
- 导入
com.illuzor.sharingextension.SharingExtension;
由于不清楚您的确切问题是什么(因为没有提供足够的信息)...
(1)您是否导入了所需的Class文件?
import com.illuzor.sharingextension.SharingExtension;
btn_Share.addEventListener (MouseEvent.CLICK, shareAndroid);
function shareAndroid (event: MouseEvent): void
{
//# If this works then replace with bitmap code (use shareImage)
SharingExtension.shareText ("AS3 Test", "This text is from AS3 code");
}
(2)是否将ANE添加(连接)到项目中(在“设置”中)?
请阅读以下内容以获取有关添加ANE的建议:
https://www.adobe.com/devnet/air/articles/using-ane-in-flash.html