Sliding Puzzle AS2 Class

Sliding Puzzle AS2 HelpSliding Puzzle AS2 Help

Help documentation and instructions about installing and using the Sliding Puzzle ActionScript 2.0 Component for Flash MX developed by someFrogs. 

Flash Sliding Puzzle ActionScript 2.0 Class

Inheritance UIObject > UIComponent > SlidingPuzzle

ActionScript Class Name someFrogs.Puzzles.SlidingPuzzle

The properties of the SlidingPuzzle class allow you to set the content picture, render it as a jigsaw puzzle, and adjust the piece resolution at runtime.

Setting a property of the SlidingPuzzle class with ActionScript overrides the parameter of the same name set in the Property Inspector or Component Inspector panel.

Method summary for the Flash Sliding Puzzle ActionScript 2.0 Class

Method

Description

SlidingPuzzle.startPuzzle()

Starts or restarts the puzle with the given or preset paremeters if not passed any.

Usage myPuzzle.startPuzzle([Linkage [,hRez [,vRez [,auMix, [hStyle]]]]]);
Parameters

Linkage: A string that indicates a reference to an external image file or the library Linkage ID of the symbol to be rendered as puzlle. Sets the picLinkage property.

hRez, vRez: Nubers between 2 and 12 indicating the piece resolution of the puzle setting the puzzleRezH and puzzleRezV properties. The result of multiplication of those two numbers gives the number of pieces the picture will be devided to. SlidingPuzzle component atomaticaly applies the biger number to the bigger dimention property (with or height) of the rendered picture. The preset value is used if not passed.

auMix: A boolen indicating if the puzzle shall start mixing with the auto-calculated mix steps (5* pieceCount) immediately after start. If it's false a mixPuzzle(mixSteps) command is expected to trigger the mix. Sets the autoMix property. The preset value is used if not passed.

hStyle: A string indicating the style of the hints setting hintStayle property. The possible values are: "none" for no hints, "count" for streight count numbers and "matrix" for row - column numbers as hints. "none" by default.

The parameters are not required. Last set or preset parameters are uset insted of ones pased as NULL.
See the SlidingPuzzle.autoStart and SlidingPuzzle.autoMix properties if you want to bypass this method.

Examples

myPuzzle.startPuzzle();
Starts or restarts the puzle with the last parameters passed or parameters given via Property Inspector Panel.

myPuzzle.startPuzzle("mySymbol", 3, 4, true, "count");
Starts a puzzle with mySymbol as picture, 3x4=12 pieces, mixed immediately and "count" style hints.

SlidingPuzzle.mixPuzzle()

Starts mixing puzzle with the given steps.

Usage myPuzzle.mixPuzzle(Steps);
Parameters

Steps: A number indicating how many steps the puzzle is going to be mixed.

Examples

myPuzzle.startPuzzle("mySymbol", 3, 4, false, "count");
Starts a puzzle that will wait for a startPuzzle() command. A false passed for autoMix.

myPuzzle.mixPuzzle(101);
Starts a 101 step mixing prosedure.

Inherits all methods from UIObject and UIComponent.

Property summary for the Flash Sliding Puzzle ActionScript 2.0 Class

Method

Description

SlidingPuzzle.picLinkage

A reference to an external image file or the symbols library linkage ID to be rendered. Takes affect after SlidingPuzzle.startPuzzle().

SlidingPuzzle.puzzleRezH

The horizontal resolution number. Actualy it may apply to vertical resolution according to dimentions of rendered symbol. Takes affect after SlidingPuzzle.startPuzzle().

SlidingPuzzle.puzzleRezV

The vertivcal resolution number. Actualy it may apply to horizontal resolution according to dimentions of rendered symbol. Takes affect after SlidingPuzzle.startPuzzle().

SlidingPuzzle.autoStart

Indicates whether startPuzzle is expected to triger the rendering process. Use true to start the puzzle with settings passed via Property Iinspector or Component Inspector panel and false if you wish to start puzzle after passing parameters at runtime. The default value is true.

SlidingPuzzle.autoMix

Indicates whether mixPuzzle is expected to triger the mix process. Use true to start mixing with the auto-calculated mix steps (5* pieceCount) immediately after start. Use false if you wish to use a custom number of steps to mix. In this case you need to refer to mixPuzzle()command at runtime. The default value is true.

SlidingPuzzle.hintStyle

Indicates the style of the hints. The possible values are: "none" for no hints, "count" for streight count numbers and "matrix" for row - column numbers as hints. "none" by default.

Inherits all properties from UIObject and UIComponent.

Event summary for the Flash Sliding Puzzle ActionScript 2.0 Class

Method

Description

SlidingPuzzle.mixed

Event; broadcast to all registered listeners when the SlidingPuzzle is finished mixing process.

SlidingPuzzle.moved

Event; broadcast to all registered listeners when a piece of the SlidingPuzzle is moved.

SlidingPuzzle.done

Event; broadcast to all registered listeners when the SlidingPuzzle is done.

Usage
listenerObject = new Object();
listenerObject.mixed = function(eventObject){
// here actualy starts interaction triger your timer here
}
listenerObject.moved = function(eventObject){
// put your sound for movement here
}
listenerObject.done = function(eventObject){
// insert your code here
}
myPuzzleInstance.addEventListener("mixed", listenerObject);
myPuzzleInstance.addEventListener("moved", listenerObject);
myPuzzleInstance.addEventListener("done", listenerObject);

Inherits all events from UIObject and UIComponent.

Using Sliding Puzzle AS2

Sliding Puzzle AS2
Sliding Puzzle AS2

Sliding Puzzle ActionScript 2.0 is a Flash MX UI Component developed and packed as Extension by someFrogs. You can build and publish your own sliding puzzles easy if you are a litle familiar to Flash MX. Sliding Puzzle ActionScript 2.0 Component can render any external image (jpeg, swf and formats supported by Flash MX Player) file or any symbol in the Flash's library as a sliding puzzle.