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 – creating a data save stack


We're going to make a copy of a stack, but only if another copy of that stack doesn't exist. LiveCode has a nice if there is a… function, which was made for times like this!

First, we will create the stacks we'll need by following these steps:

  1. Start a new Mainstack with the name LaunchStack. Save it somewhere other than your computer's Documents folder.

  2. Start another new Mainstack with the name AppStack. Save it in the same folder as the first stack.

  3. Place some data on each stack's card, so that you can easily recognize when you're in that stack. For example, drag a button onto the card of the LaunchStack stack and name it in a way that makes it very easy to recognize. Do the same for the AppStack stack.

  4. Put the following openStack handler in the stack script of LaunchStack:

    on openStack
      set the defaultFolder to specialFolderPath("Documents")
      if there is not a file "AppStack.livecode" then
      put the filename of this stack into masterfile
        set...