Save Flex4 screenshots to tough drive weblog category: FlexFlexAdobeFlash.netXML
Bean Bechfree download full version samsung memory card data recovery software ? Xmlversion = '1.0' encoding = 'utf-8'? S: Applicationxmlns: 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 'creationComplete =' application1_creationCompleteHandler (occasion) 'width =' 655 'height = '512' fx: Declarations!- deleted samsung memory card data recovery -visual elements (for example services, worth objects) here-/ fx: Declarationsfx: Script! [CDATA [importflash.net.FileReference; importmx.events.FlexEvent; importmx .graphics.ImageSnapshot; importmx.graphics.codec.JPEGEncoder; privatevarbitmaps: IBitmapDrawable; privatevarjietuWidth: Quantity; privatevarjietuHeight: Number; privatevarfile: FileReference; privatevarbit: BitmapData; / *** click screenshot approach * / protectedfunctionbutton1_clickHandler (occasion: MouseEvent): void // Show save as button saveas.visible = true; // Get selected snapshot of component bit = ImageSnapshot.captureBitmapData (bitmaps) asBitmapData; // Set the width and height of the corresponding snapshot jietu.width = jietuWidth; jietu.height = jietuHeight; // Display the obtained snapshot jietu.sour ce = newBitmap (bit); / *** Click to save as system * / protectedfunctionsaveas_clickHandler (event: MouseEvent): void // Hide save as button saveas.visible = false; // Get the snapshot of the component varimgData: ImageSnapshot = ImageSnapshot .captureImage (bitmaps, 0); // Call the file save method to save the generated image to the hard disk file.save (imgData.data, 'image.png'); / *** Replace the screenshot target * / privatefunctiononClick (event: Occasion ): void switch (event.target) casebeijietu1: // Replace the component to get the snapshot to beijietu1 component bitmaps = beijietu1; // Draw the outer frame line according to the coordinate width and height of the beijietu1 component drawKuang (beijietu1.x, beijietu1.y, beijietu1.width, beijietu1.height); // Set the component that displays the snapshot to be wide and highjietuWidth = beijietu1.width; jietuHeight = beijietu1.height; break; casebeijietu2: // Replace the component that gets the snapshot to beijietu2 component bitmaps = beijietu2; / / Draw the outer frame line drawKuang (beijietu2.x, beijietu2.y, beijietu2.width, beijietu2.height) according to the coordinate width and height of the beijietu2 component; // Set the component that displays the snapshot to be wide and highjietuWidth = beijietu2.width; jietuHeight = beijietu 2.height; break;) / *** Frame the picture to become captured * / privatefunctiondrawKuang (kx: Quantity, ky: Number, kw: Quantity, kh: Quantity): void // Clear the current drawing content s.graphics .clear (); // Set the drawing line style s.graphics.lineStyle (1,0x00ff00,2); // Draw the rounded rectangle s.graphics.drawRoundRect (kx, ky, kw, kh, 5,5); / / End drawing fill s.graphics.endFill (); protectedfunctionapplication1_creationCompleteHandler (event: FlexEvent): void // Get snapshot of beijietu1 component by default bitmaps = beijietu1; // Create upload and download file object file = newFileReference ();]] /fx:Scriptmx:Imagesource='@Embed('1.jpg')'id='beijietu1'x='21'y='26'click='onClick(occasion)'buttonMode='true'/mx:Imagesource = '@ Embed (' 2.jpg ')' id = 'beijietu2' x = '183' y = '22' click = 'onClick (event)' buttonMode = 'true' / mx: Imageid = 'jietu' x = '21' y = '237' width = '151' height = '104' / s: Buttonx = '51' y = '189' label = 'Screenshot' click = 'button1_clickHandler (occasion)' buttonMode = 'true' / s: Buttonx = '133' y = '188' label = 'Save as' id = 'saveas' click = 'saveas_clickHandler (event)' visible = 'false' / s: SpriteVisualElementid = 's' // s: Application