stackoverflow.comWinter Mini Game
This is my favourite game. The user is able to dress a snowman from an option of items on the left hand side. When the user is finsihed they select done and this takes a screenshot of the snowman and opens on a new page. Along the left hand side is written happy christmas and the lyrics for frosty the snowman.
So far I have made all of the items drag-able using the startDrag and stopDrag function.
I have been researching how to do the screenshot. I found code on stackoverflow.com called “AS3 stage screen shot to hard drive save“. It has been really helpful for the code aspect but has opened a lot of problems for me at the same time. You need to have a JPGEncoder in your AS library, this has to be downloaded. I have still not been able to get this working. I have looked at the following forum The class or interface com.adobe.images.JPGEncoder could not be loaded as this was the same error i was getting. Basically you have to have the .as file within your core folder. I have done this and it still does not work.
My second problem is that the screen shot is of the whole screen. I only want it to crop a certain area of the screen. I research this a bit and I am still confused about it. I found this code on stackoverflow.com called “take snapshot of display object visible area in flash“. I looked at some code that Sean McDoonnell and this really cleared it up for me, I also got a copy of Sean’s code to look at further for cropping the area wanted. I had to create a an area using a rectangle and then set the constraints of the screenshot to the area of that rectangle.
I have this working now so I am really happy with that. I will keep trying to get the JPG to save and ask Ken on Monday if there is anything he can suggest.