spacer

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

home / experts / dhtml / column10
Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint

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

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