Hi

I have done this type functionality in flash CS3 using JPGEncoder class.

import com.adobe.images.JPGEncoder;

var jpgSource:BitmapData = new BitmapData (sketch_mc.width, sketch_mc.height);
jpgSource.draw(sketch_mc);

var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);

Regards,
Dheeraj

On Thu, Oct 21, 2010 at 3:38 PM, dhaval <[email protected]> wrote:

> how to save image in flex on server  from snapshot of  image byte
> array.
> on taking snapshot in flex  iwant to save the byte array of the image
> on server and i dont wnt to load and show the byte array of image .
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <!--
> http://blog.flexexamples.com/2007/11/16/taking-screenshots-in-flex-using-the-imagesnapshotcaptureimage-method/
> -->
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
>        layout="vertical"
>        verticalAlign="middle"
>        backgroundColor="white">
>
>    <mx:Script>
>        <![CDATA[
>            import mx.core.IUIComponent;
>            import mx.graphics.ImageSnapshot;
>
>            private function takeSnapshot(source:IBitmapDrawable):void
> {
>                var imageSnap:ImageSnapshot =
> ImageSnapshot.captureImage(source);
>                var imageByteArray:ByteArray = imageSnap.data as
> ByteArray;
>                swfLoader.load(imageByteArray);
>            }
>        ]]>
>    </mx:Script>
>
>    <mx:Array id="arr">
>        <mx:Object col1="Row 1, Col 1" col2="Row 1, Col 2" />
>        <mx:Object col1="Row 2, Col 1" col2="Row 2, Col 2" />
>        <mx:Object col1="Row 3, Col 1" col2="Row 3, Col 2" />
>        <mx:Object col1="Row 4, Col 1" col2="Row 4, Col 2" />
>        <mx:Object col1="Row 5, Col 1" col2="Row 5, Col 2" />
>        <mx:Object col1="Row 6, Col 1" col2="Row 6, Col 2" />
>    </mx:Array>
>
>    <mx:ApplicationControlBar dock="true">
>        <mx:Button label="Take snapshot of DataGrid"
>                click="takeSnapshot(dataGrid);" />
>    </mx:ApplicationControlBar>
>
>    <mx:HBox>
>        <mx:DataGrid id="dataGrid" dataProvider="{arr}" />
>
>        <mx:SWFLoader id="swfLoader">
>            <mx:filters>
>                <mx:DropShadowFilter />
>            </mx:filters>
>        </mx:SWFLoader>
>    </mx:HBox>
>
> </mx:Application>
>
> i want to save the imageByteArray on server as jpg or png image .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to