Access flex screen snapshots

Source: Internet
Author: User

<? XML version = "1.0" encoding = "UTF-8"?>
<! -- Http://yecon.blog.hexun.com/31031093_d.html -->
<Application name = "filereference_save_test"
Xmlns = "http://ns.adobe.com/mxml/2009"
Xmlns: MX = "Library: Adobe/flex/Halo"
Xmlns: Net = "flash.net .*"
Layout = "flex. layout. basiclayout"
Creationcomplete = "Init ();">
<SCRIPT>
<! [CDATA [
Private function Init (): void {
Textarea. Text = describetype (filereference). toxmlstring ();
}
Private function btn_click (EVT: mouseevent): void {
Filereference. Save (textarea. Text, "describetype.txt ");
}
]>
</SCRIPT>
<Declarations>
<Net: filereference id = "filereference"/>
</Declarations>
<Mx: Panel id = "Panel"
Width = "500"
Height = "300"
Verticalcenter = "0"
Horizontalcenter = "0">
<Mx: textarea id = "textarea"
Editable = "true"
Width = "100%"
Height = "100%" type = "parmname" text = "parmname"/>
<Mx: controlbar horizontalalign = "right">
<Button id = "BTN"
Label = "save text"
Click = "btn_click (event);"/>
</MX: controlbar>
</MX: Panel>
</Application>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
// You can also directly use the SAVE () method of the filereference class through an XML object:
<? XML version = "1.0" encoding = "UTF-8"?>
<! -- Http://yecon.blog.hexun.com/31031093_d.html -->
<Application name = "filereference_save_test"
Xmlns = "http://ns.adobe.com/mxml/2009"
Xmlns: MX = "Library: Adobe/flex/Halo"
Xmlns: Net = "flash.net .*"
Layout = "flex. layout. basiclayout"
Creationcomplete = "Init ();">
<SCRIPT>
<! [CDATA [
Private const xmlobj: xml = describetype (filereference );
Private function Init (): void {
Textarea. Text = xmlobj. toxmlstring ();
}
Private function btn_click (EVT: mouseevent): void {
Filereference. Save (xmlobj, "describetype. xml ");
}
]>
</SCRIPT>
<Declarations>
<Net: filereference id = "filereference"/>
</Declarations>
<Mx: Panel id = "Panel"
Width = "500"
Height = "300"
Verticalcenter = "0"
Horizontalcenter = "0">
<Mx: textarea id = "textarea"
Editable = "true"
Width = "100%"
Height = "100%" type = "parmname" text = "parmname"/>
<Mx: controlbar horizontalalign = "right">
<Button id = "BTN"
Label = "save"
Click = "btn_click (event);"/>
</MX: controlbar>
</MX: Panel>
</Application>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
// You can use the imagesnapshot class to capture the object and save it to the local hard disk by handing the bytearray to the SAVE () method object of the filereference class:
<? XML version = "1.0" encoding = "UTF-8"?>
<! -- Http://yecon.blog.hexun.com/31031093_d.html -->
<Application name = "filereference_save_test"
Xmlns = "http://ns.adobe.com/mxml/2009"
Xmlns: MX = "Library: Adobe/flex/Halo"
Xmlns: Net = "flash.net .*"
Layout = "flex. layout. basiclayout"
Creationcomplete = "Init ();">
<SCRIPT>
<! [CDATA [
Import MX. Graphics. imagesnapshot;
Import MX. Graphics. codec .*;
Private const incluenc: incluencoder = new incluencoder ();
Private const xmlobj: xml = describetype (filereference );
Private function Init (): void {
Textarea. Text = xmlobj. toxmlstring ();
}
Private function btn_click (EVT: mouseevent): void {
VaR imagesnap: imagesnapshot = imagesnapshot. captureimage (panel, 0, jpegenc );
Filereference. Save (imagesnap. Data, "describetype.jpg ");
}
]>
</SCRIPT>
<Declarations>
<Net: filereference id = "filereference"/>
</Declarations>
<Mx: Panel id = "Panel"
Width = "500"
Height = "300"
Verticalcenter = "0"
Horizontalcenter = "0">
<Mx: textarea id = "textarea"
Editable = "true"
Width = "100%"
Height = "100%" type = "parmname" text = "parmname"/>
<Mx: controlbar horizontalalign = "right">
<Button id = "BTN"
Label = "save"
Click = "btn_click (event);"/>
</MX: controlbar>
</MX: Panel>
</Application>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.