Using Jigsaw Puzzle AS2

Jigsaw Puzzle AS2 HelpJigsaw Puzzle AS2 Help

Help documentation and instructions about installing and using the Jigsaw Puzzle AS2 Component for Flash MX developed by someFrogs. 

Using Flash Jigsaw Puzzle ActionScript 2.0 Component.

Flash Jigsaw Puzzle ActionScript 2.0 Component parameters

The following are authoring parameters that you can set for each Jigsaw Puzzle Component instance in the Property inspector or in the Component Inspector panel:

picLinkage indicates a file reference to an external image (jpeg, swf) file or the linkage identifier of a movie clip symbol in the library that is set to Export for ActionScript. Additional explanation is provided in creating applicaions topic below for those who are not familiar to symbols in Flash.

puzzleRezH indicates one of the numbers (horizontal or vertical depending on dimensions of the picture) the picture will be divided to. This property is applied to bigger value of width and height if it is bigger than puzzleRezV. Available values are 2 to 12. The default value is 2.

puzzleRezV is the second resolution value and the multiply with puzzleRezH gives the total piece number of the puzzle. Available values are 2 to 12. The default value is 2.

enableRotation is a Boolean value indicating if the puzzle pieces can be rotated using the spacebar, arrow keys and mouse wheel. Don't forget to put a notice to your application about functionality of the keys.

autoStart is a Boolean value indicating if the puzzle shall start with the parameters set in the Property inspector or in the Component Inspector panel. If it's false a startPuzzle() command is expected to trigger the puzzle. True by default.

shapeStyle Indicates the style of the shapes. The possible values are: "classic", "oval", "sqare", "triangle" and "mixed". "classic" by default. (Added in v2.1).

matchBlinkCount indicates a number for blink counts on matched pieces. Enter 0 if you don't want the pieces blink on match. 5 by default. (Added in v2.2).

You can write ActionScript to control these and additional options for JigsawPuzzle components using its properties, methods, and events. For more information, see JigsawPuzzle class Methods, Properties and Events documentation .

Creating an application with the Flash Jigsaw Puzzle ActionScript 2.0 Component

The following procedure explains how to add a JigsawPuzzle component to an application while authoring.

To create an application with the Flash Jigsaw Puzzle ActionScript 2.0 Component, do the following:

a) Importing the picture and converting it to symbol (skip this step if you want to render an external image file).

  1. Select File > Import to Stage.
  2. In the Import dialog box, select your picture file and click Open. Your picture must appear on the stage.
  3. Select your picture, select Modify > Convert to Symbol (or pres F8). In the Convert to Symbol dialog select Movie Clip as Behavior, Top-Left corner as registration, click Advanced button if the dialog is in Basic mode, select Export for ActionScript and Export in first frame, enter myPicture in the Identifier field and click Ok.
  4. Delete the picture from the stage or resize it as a thumbnail to give visual idea to your users about the result of the puzzle.

Now you have your picture in your Library panel, marked as Export for ActionScript with Linkage Identifier myPicture and you are ready to continue with step b.

b) Setting Flash Jigsaw Puzzle ActionScript 2.0 Component to render the picture.

  1. Drag a JigsawPuzzle component from the Components panel to the Stage.
  2. Resize the component so it can contain the picture and some free space to be left in order to users can handle with the pieces.
  3. In the Property inspector, enter the instance name myPuzzle.
  4. In the Property inspector, enter myPicture or somedir/somefile.jpg for the picLinkage parameter and numbers between 2 and 12 for puzzleRezH and puzzleRezV.
  5. Select Control > Test Movie.

c) Adding a done listener to the puzzle.

  1. Select Frame 1 in the Timeline, open the Actions panel, and enter the following code:
    puzzleListener = new Object;
    puzzleListener.match = function() { trace("matched pieces"); }

    puzzleListener.done = function() { trace("the puzzle is done"); }
    myPuzzle.addEventListener("match", puzzleListener);myPuzzle.addEventListener("done", puzzleListener);

    This block of code creates event handlers for the done and match events that send a message to the Output panel.

Jigsaw Puzzle AS2 Installation & UpgradeJigsaw Puzzle AS2 Class

Jigsaw Puzzle AS2
Jigsaw Puzzle AS2

Jigsaw Puzzle ActionScript 2.0 is a Flash MX 2004 UI Component developed by someFrogs. Unlike most other jigsaw puzzle generators for Flash, Jigsaw Puzzle AS2 recognizes the neighbour pieces put near in right direction and then groups them. This makes the puzzle game more real and more fascinating. With this easy to use and customizable flash puzzle script you can build your own jigsaw puzzles that can be published as online flash games or compiled as desktop flash game applications.