Hi,
Here is my code....



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; styleName="plain">

    <mx:Script>

        <![CDATA[
            import mx.graphics.codec.PNGEncoder;
        import mx.rpc.events.ResultEvent;
        private var isDrawing:Boolean=false;
        private var x1:int;
        private var y1:int;
        private var x2:int;
        private var y2:int;

        private var drawColor:uint;

        private function doErase():void
        {
            canvas.graphics.clear();
        }

        private function doMouseDown():void
        {
            x1 = canvas.mouseX;
            y1 = canvas.mouseY;
            isDrawing = true;
        }

        private function doMouseMove():void
        {
            x2 = canvas.mouseX;
            y2 = canvas.mouseY;
            if (isDrawing)
            {
                canvas.graphics.lineStyle(2, drawColor);
                canvas.graphics.moveTo(x1, y1);
                canvas.graphics.lineTo(x2, y2);
                x1 = x2;
                y1 = y2;
            }
        }

        private function doMouseUp():void
        {
            isDrawing = false;
        }

        private function doSave():void
        {
            var PNGEnc:PNGEncoder=new PNGEncoder();
            var bd:BitmapData = new BitmapData(canvas.width,canvas.height);
            bd.draw(canvas);
            var ba:ByteArray = PNGEnc.encode(bd);
        }
        ]]>

    </mx:Script>

       <mx:Panel title="FlexPaint">

        <mx:Canvas id="canvas" width="300" height="300"
            horizontalScrollPolicy="off" verticalScrollPolicy="off"
            mouseDown="doMouseDown()"
            mouseMove="doMouseMove()"
            mouseUp="doMouseUp()"/>

        <mx:ControlBar>
            <mx:ColorPicker change="drawColor =
event.target.selectedColor"/>
            <mx:Button label="Erase" click="doErase()"/>
            <mx:Button label="Save Image" click="doSave()"/>
        </mx:ControlBar>

    </mx:Panel>

</mx:Application>



This is actually a sample code.... Actually the user can draw an image in
the canvas by moving the mouse...Once after drawing the equation if he
clicks on " Save Image " I call a function called doSave() where i convert
it canvas data in to a bitmap and then convert it into a byte array using
the PNGEncoder... Now i need a jsp file to capture the byte array decode it
back store it in a file and save it in server.. the latter part storing it
in server i will see to it.. What i need is
1) To pass the byte array from flex to jsp.
2)Capture it in jsp decode it and store it in a file...

On Wed, Oct 1, 2008 at 3:19 PM, HISSAM <[EMAIL PROTECTED]> wrote:

> Dear Satish can u send me ur flex application so that i can work on it to
> extract byte array in java
>             I'm at present working on it but need real byte stream. UR
> appliaction would be an addon
>
>
>> -----------------------------
> Warm Regards,
>  HISSAM,
>  Soft Engg,
>  iThinkLabs Pvt Ltd.
>  India.
> website:http://www.ithink-labs.com
>            http://www.yureekah.com
> ------------------------------
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

  • ... friends
    • ... Varun Shetty
      • ... Satish பேர கேட்டா சும்மா அதுருதில
        • ... Satish பேர கேட்டா சும்மா அதுருதில
          • ... Satish பேர கேட்டா சும்மா அதுருதில
            • ... HISSAM
              • ... Satish பேர கேட்டா சும்மா அதுருதில
                • ... ragavenderan venkatesan

Reply via email to