spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / dhtml / column10
Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source
Logo

The DHTML Lab Jigsaw Puzzle, Part III: NN4
cleaning up after the solve


Final Positioning

When a piece is finished flashing after correct manual positioning, or during an automatic solve, the origPos() function is called.

The puzzle piece is positioned in the correct position, and its draggable property becomes false to disable further dragging of the piece. The number of pieces solved, stored in solvedCount, is incremented and allDone() is called, with an argument of true, if we are finished solving.

Clean-up

The single Boolean argument of allDone(), internally named solved, tells the function whether to clean up after a complete solve, or during play. A value of false is passed to allDone() by initPuzz() and breakUp(), if you recall, when a new image is loaded, or a new piece count is asked for, and we still have unsolved dispersed pieces.

When allDone() is called, it hides all the puzzle pieces, dispersed or not. If the grid is on, it gets hidden, as does the elBlank element. This results in the original puzzle image becoming visible.

The full puzzle is made draggable, if the user has chosen it to be, and solvedCount is re-initialized. If the puzzle has been completely solved, then the relevant variables are re-initialized and the full image is flashed.

To complete the Navigator puzzle code discussion, let's look at the remaining functions, which are all connected with the control panel buttons.


Produced by Peter Belesis and

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Working with the DOM Stylesheets Collection · Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Combine BottomCount() with Other MDX Functions to Add Sophistication · Creating a Daemon with Python · The Coming Voice-over-WiMAX Revolution

All Rights Reserved. Legal Notices.
Created: Nov. 27, 1997
Revised: Jan. 18, 1998

URL: http://www.webreference.com/dhtml/column10/puzzNSdone.html