我可以打开浏览器窗口来查看由 Flex 3 应用程序创建的图像吗?
我有一个 Flex 3 应用程序,它从用户在其上绘制的画布创建图像。我使用 ImageSnapshot 类创建图像,
var imageSnap:ImageSnapshot=ImageSnapshot.captureImage(myCanvas);
var imageByteArray:ByteArray=imageSnap.data as ByteArray;
我希望用户能够打印或保存图像。我可以使用以下代码来打印图像,但 Flex 无法很好地控制跨多个页面的打印
var printJob:FlexPrintJob=new FlexPrintJob();
printJob.start();
printJob.addObject(myCanvas, FlexPrintJobScaleType.SHOW_ALL);
我想在浏览器窗口中显示图像,以便用户可以使用内置浏览器功能打印它或右键单击图像并保存。可以在不请求服务器端代码的情况下完成此操作吗? 我知道 Flash Player 10 和 Flex 4 允许您在本地保存文件,但现在我只能使用 Player 9 和 Flex 3
I have a flex 3 application that creates an Image from a canvas which the user draws on. I use the ImageSnapshot class to create the image
var imageSnap:ImageSnapshot=ImageSnapshot.captureImage(myCanvas);
var imageByteArray:ByteArray=imageSnap.data as ByteArray;
I want the user to be able to print or save the image. I can use the following code to print the image but flex does not provide good control over printing across multiple pages
var printJob:FlexPrintJob=new FlexPrintJob();
printJob.start();
printJob.addObject(myCanvas, FlexPrintJobScaleType.SHOW_ALL);
I would like to display the image in a browser window so that the user could print it using the built in browser functionality or right click on the image and save it. Can this be done without requesting server side code to do it?
I know that flash player 10 and flex 4 allow you to save files locally but for now I am stuck with player 9 and flex 3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只要应用程序在 Flash Player 10 中运行,您仍然可以在 Flex 3 中使用 FileReference 的新功能(save() 和 load() 方法)。但是,如果您确实坚持使用 Flash Player 9,那么您将需要首先将图像推送到服务器。如果您正在寻找一种将数据推送到服务器的好方法,请参考我在这个问题中的解决方案:
Flex:将未实现的 UIComponent 渲染为 BitmapData?
You can still use the new features of FileReference (the save() and load() methods) in Flex 3 as long as the application is running in Flash Player 10. But if you are definitely stuck with Flash Player 9 then you will need to push the image up to the server first. If you are looking for a good way to push that data up to the server, please reference my solution in this question:
Flex: Render an unrealized UIComponent to BitmapData?
我不相信你可以这样做,因为它会违反沙箱。例如,如果这有效,则意味着您可以在未经用户同意或不知情的情况下在用户的计算机上放置任意代码(类似于图像)。
I don't believe you can do this, as it would violate the sandbox. For example, if this worked, it means you could put arbitrary code (analogous to an image) on the user's machine without their consent or knowledge.
我不确定这是否有效,但请尝试以下操作:
显示图像的链接 (file://path/to/image/img.ext) 并设置
window.htmlLoader.navigateInSystemBrowser = true;
I'm not sure if this will work, but try this:
Show a link to the image (file://path/to/image/img.ext) and set
window.htmlLoader.navigateInSystemBrowser = true;