8 Replies Latest reply on May 28, 2007 1:21 AM by Greg Dove

    Cropping tool made with Actionscript

    Sw Jiten Level 1
      I am looking for some tutorials about managing images with actionscript like: cropping a picture, rotating, moving, increasing, decreasing (zoom in , zoom out). For best understanding, please come inside this example, and let me know where to find related summaries.. I will appreciate your help:

      http://www.mandalavillage.com/croppingtool.html

      Thanks in advance,
        • 1. Re: Cropping tool made with Actionscript
          kglad Adobe Community Professional & MVP
          check for a tutorial on using the bitmapdata class.
          • 2. Re: Cropping tool made with Actionscript
            Sw Jiten Level 1
            does not say too much.... please any further help ? thanx again...
            • 3. Re: Cropping tool made with Actionscript
              kglad Adobe Community Professional & MVP
              are you using as2 or as3?

              in both situations you can do what you want using the flash bitmapdata class. this is not an elementary undertaking, however so you'll need to gain facility with that class before you can use it crop bitmaps.

              everything else you can do using the movieclip class in as2. in as3 there are other displayobject classes that can also be used.
              • 4. Re: Cropping tool made with Actionscript
                Sw Jiten Level 1
                do you know any specific tutorial please ? I am looking on the web also but I'll appreciate any further info, thanks so much,
                • 5. Re: Cropping tool made with Actionscript
                  kglad Adobe Community Professional & MVP
                  no, i don't know of any tutorials. using google to search is often helpful.
                  • 6. Re: Cropping tool made with Actionscript
                    Sw Jiten Level 1
                    if I found any tutorial at google, believe me ... I would never ask you ... if you really can help me with any address I will appreciate it.. anyone please ? thanx,
                    • 7. Re: Cropping tool made with Actionscript
                      Greg Dove Level 4
                      I don't understand... there's some good stuff on bitmapdata easily found...

                      Google:
                      http://www.google.fr/search?hl=en&q=bitmapdata+flash+tutorial

                      For you app, do all your manipulation of the images using movieclips (with masking - you'll have to do that with your draggable points for the 'cutout') and then use bitmapdata to take a snapshot. I've never done what you want to do but that's how I'd do it, after 2 mins reading of the first link from this google search - which is an adobe tutorial. There's a section titled 'snapshots' on page 3 of the adobe tutorial.

                      If you're looking for a tutorial that's a perfect fit with your full requirements then - that would very likely be difficult to find. In this case you have to learn the different aspects of what you want to do separately and then combine the knowledge and use it all in your project. E.g. If you're not familiar with scaling, moving and positioning movieclips, masking etc with actionscript then you also need to find a tutorial on that or read through the adobe documentation as well.






                      • 8. Cropping tool made with Actionscript
                        Greg Dove Level 4
                        I took another look at your mockup. Using a mask movieclip is not essential- you could have a layer above the photo and with a clip with a 'hole' in it. But I think I'd do it with a mask clip. Have all your markers as draggable clips that provide coordinates points for line drawing (in this case curveTo), with each update from a drag resulting in a redraw of the shape in the mask clip and using the beginFill/endFill methods of the drawing api to make sure the shape is filled. Have your mask clip and photo clips inside another clip. Use bitmapdata to copy the current state of the parent clip of them both. If your draggable marker clips are inside the same parent clip then you should make them not visible before using bitmapdata. I'd probably keep them (the marker clips for the points) inside the same parent clip all contained in a 3rd higher depth movieclip (above the one used for masking the photo) and then just make that (marker) parent clip not visible before taking the bitmapdata snapshot.

                        That's the approach I'd use... there may be other/better approaches. And its probably more complicated than I described as you do it (it always is when you get closer to the detail!) - e.g. I'm not sure how difficult it would be to capture the transformations of the photo which would be a child of the movie that's being copied in the bitmap... see the tutorial info about transform matrices... but if its not straightforward I'm sure that's a good learning experience and you can always try asking specific questions here or elsewhere if you get stuck.