Monday, December 13, 2010

Quick Tip: Creating a Snapshot Tool in Flash

Quick Tip: Creating a Snapshot Tool in Flash: "

In this Quick Tip, I’ll show you how to create a Shapshot Tool that copies part of the stage and saves the result as a PNG image.


Final Result Preview

This is the final result. Just click the stage and then drag the mouse to take a snapshot.


Step 1: Download the as3corelib Class

Create a new folder for this project and give it any name you want. Go to Github and download the latest version of the as3corelib Class. For this Quick Tip I’ve used version .93. Extract the ZIP file and go to as3corelib-.93 > src.

Copy the com directory to your newly created folder. This package has a very useful PNGEncoder Class that we will use for encoding the
snapshot into a PNG image.


Step 2: Setup your Flash File

Launch Flash and create a new Flash Document. Make sure it’s set to publish to Actionscript 3.0 and Flash Player 10. You can check this in the Properties
panel or by selecting Publish Settings… and then clicking on the Flash tab.

The Flash Properties Panel

Step 3: Content to be Snapped

We need some content in the Flash file to check if the snapshot tool is working properly. We’re going to create some circles and place them randomly around the stage. Create a new Document Class called Circles.as and add the following code. Remember to link the Class to the Flash file by writing Circles in the Class field in the the Properties Panel [...]

Read more: Quick Tip: Creating a Snapshot Tool in Flash

No comments:

Post a Comment