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 – setting up touch events


The handlers so far have been in the card script, the plan being to have different cards with different types of puzzle. The interactivity handlers can be placed in the stack script available for all the cards.

  1. Open the stack script. There is only one of the global variables that we will also need in the stack script, but there are a couple of initializing items we need to cover. Start the stack script with these lines:

    global snapdistance
    
    on preopenstack
      if the platform contains "iphone" then iphoneUseDeviceResolution true
    end preopenstack
    
    on openstack
      set the compositorType of this stack to "Static OpenGL"
    end openstack
  2. The preopenstack handler checks whether the app is on iPhone and requests that the device's native resolution be used. This will make sure that Retina displays show the best quality. The compositorType being set to "Static OpenGL" will help performance.

  3. The interactivity we'll use will make use of touch events. Each touch comes...