spacer

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

home / experts / dhtml / column10
Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

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.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

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

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business

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

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