Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Overview of this book

Table of Contents (15 chapters)
LiveCode Mobile Development Beginner's Guide Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – transferring imageData


By setting the chosen image to be of the same width and height as the group that holds the puzzle pieces (that's where the 900 and 662 numbers came from), it becomes possible for us to transfer the matching rectangle of data from the full image to the puzzle piece in question. The following steps will guide you in transferring imageData:

  1. Open the card script again. Add the makepuzzle handler:

    on makepuzzle
      resetpuzzle
      put the number of images in group "pieces" into imagecount
      repeat with a = 1 to imagecount
        makepiece the short name of image a of group "pieces"
      end repeat
    end makepuzzle
  2. The makepuzzle handler will go through each of the puzzle pieces and call another handler to do the transfer of data for that one piece. Here is the makepiece handler:

    on makepiece piecename
      put the width of image piecename into piecewidth
      put the height of image piecename into pieceheight
      put empty into tempimage
      put the left of image piecename - the...