10 Replies Latest reply on Jun 8, 2007 1:19 PM by kglad

    How to Draw on JPG

    Sarawinder
      Hello
      I am totally new to flash actionscript. I have an image in jpg and it has some shapes ,say a ball. I want the user to be able to draw the ball over it. How can I do this in actionscript. I when I have selected a closed contour I want to tell an application running on another computer, probably on webserver that I have selected a particular shape like in this example a ball.

      Is this possible in actionscript.

      Thanks

        • 1. Re: How to Draw on JPG
          kglad Adobe Community Professional & MVP
          how do you determine what constitutes a "closed contour"?
          • 2. Re: How to Draw on JPG
            Sarawinder Level 1
            Hi Kglad

            Whenever I complete a circle, oval or anything which is within a complete line which I have drawn, I am calling it a contour or a closed shape.
            • 3. Re: How to Draw on JPG
              kglad Adobe Community Professional & MVP
              you can determine if the start point and end point of a drawing are the same (or close enough to be considered identical). that would include things like a figure eight.

              if that's ok, flash can handle that. what is it you want done with the shape?
              • 4. How to Draw on JPG
                Sarawinder Level 1
                I have a matlab application that is running on the webserver. I want the matlab application that a particular area has been selected on the image and the application does some image processing on that image.

                Kglad, checking only for start and end points would make sure that i have selected a closed shape but how would i know at the webserver end what shape has been selected. For that I need to send some referecne point( like mouse movements but don't have any idea)
                • 5. Re: How to Draw on JPG
                  kglad Adobe Community Professional & MVP
                  i have no idea what data your matlab application needs. it can be sent an image or a sequence of data points describing the circumference of the closed contour but you need to know what data matlab expects.
                  • 6. Re: How to Draw on JPG
                    Sarawinder Level 1
                    Yeah I know what data my matlab applications is expecting. But I don't have any idea how I can send it using actionscript. I mean the tools which it has. I have questions like

                    1) What language should I write the scripts in, which is running on the server and communicating with the user and the matlab on the server.
                    2) Is there a good support in the actionscript to talk to scripts running on the server and can I pass different values to the script.
                    3) Can actoinscript pass my whole image after I have selected the area (by drawing on it)

                    I would really appreciate your views
                    • 7. Re: How to Draw on JPG
                      kglad Adobe Community Professional & MVP
                      1) flash should be able to send and receive data from any server-side program

                      2) php and perl are the most commonly used server-side languages to communicate with flash.

                      3) actionscript can pass data that encodes your image.

                      but exactly what are you sending? are you loading an image (like a jpeg) into flash, using the drawing api to "draw on the image" and then sending the "new drawn-on" image as a data stream to server-side code?
                      • 8. Re: How to Draw on JPG
                        Sarawinder Level 1
                        What do you mean data that encodes the image? You mean the actual image right?

                        I am sending the image after drawing on the shape(drawing is acting like a selection for the shape I want to select on the image)
                        • 9. Re: How to Draw on JPG
                          Sarawinder Level 1
                          What do you mean data that encodes the image? You mean the actual image right?

                          I am sending the image after drawing on the shape(drawing is acting like a selection for the shape I want to select on the image)

                          Can you please tell me what functions I should be using for passing values to the script.

                          Where can I find good documenttion for writting php or perl scrpts for communicating with actionscript.
                          • 10. Re: How to Draw on JPG
                            kglad Adobe Community Professional & MVP
                            computers don't handle images. they handle data.

                            human beings can handle images if they have a hardcopy print or painting etc. but not computers or other machines that deal with digital data only.

                            so, it makes no sense to talk about an image that's processed by a computer without talking about the data that encodes the image.

                            and if you're using the drawing api to, for example, circumscribe a bird that's in a nature scene (image), you'll have quite a bit of actionscripting to do to extract that bird's data from the image (using the bitmapdata class).