如何进行“打印屏幕”从您的 FLEX 应用程序并将其保存到硬盘驱动器?

发布于 2024-08-28 22:48:40 字数 1151 浏览 3 评论 0原文

所以我的应用程序有这样的代码,

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

    <fx:Script>
        <![CDATA[
            protected function prtscrn_clickHandler(event:MouseEvent):void
            {
                // save current RIA view as a PNG or JPG to users FileSistem
            }
        ]]>
    </fx:Script>

    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Button x="21" y="10" label="Print Screen" id="prtscrn" click="prtscrn_clickHandler(event)"/>
    <s:TitleWindow x="45" y="98" width="282" height="303">
        <s:CheckBox x="25" y="10" label="CheckBox"/>
        <s:Button x="24" y="44" label="Button"/>
        <mx:DateChooser x="24" y="76"/>
    </s:TitleWindow>
</s:Application>

我想在单击按钮时将其类似“打印屏幕”的内容保存到用户硬盘驱动器中。

怎么办这样的事?

So I have such code for my application

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

    <fx:Script>
        <![CDATA[
            protected function prtscrn_clickHandler(event:MouseEvent):void
            {
                // save current RIA view as a PNG or JPG to users FileSistem
            }
        ]]>
    </fx:Script>

    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:Button x="21" y="10" label="Print Screen" id="prtscrn" click="prtscrn_clickHandler(event)"/>
    <s:TitleWindow x="45" y="98" width="282" height="303">
        <s:CheckBox x="25" y="10" label="CheckBox"/>
        <s:Button x="24" y="44" label="Button"/>
        <mx:DateChooser x="24" y="76"/>
    </s:TitleWindow>
</s:Application>

I want to save Its something like "Print Screen" to users hard drive on button click.

How to du such thing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终难遇 2024-09-04 22:48:40

不幸的是,您无法打印整个用户的桌面,只能“打印屏幕”flash 文件。伪代码如下:

var b:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
b.draw(stage);

// create reference that will be the saved file
var ref:FileReference = new FileReference();

// add listeners for filereference ...

// save the bitmapdata
ref.save(b.getPixels(b.rect));

Unfortunately you can't Print Screen the whole user's desktop, you can only "Print Screen" the flash file. Pseudo-code below:

var b:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
b.draw(stage);

// create reference that will be the saved file
var ref:FileReference = new FileReference();

// add listeners for filereference ...

// save the bitmapdata
ref.save(b.getPixels(b.rect));
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文