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 the Media card scripts


Copy the functions that you have proved to work, in the test stack script and paste them into the WebScraper stack script. Then, perform these steps:

  1. Go to the Media card. As with the Links card, we're not going to add any controls to the card, as we'll do that with the script. So, edit the card script.

  2. Here's the Media card's init function and the needed global variables:

    global gPageHTML,gMediaList
    
    on init
      if the platform is "iphone" or the platform is "android" then
        put getMedia(gPageHTML) into gMediaList
        if the number of lines in gMediaList = 0 then
          answer "There is no media in this page!"
        else
          set the itemdelimiter to "/"
          put empty into tMediaNames
          repeat with a = 1 to the number of lines in gMediaList
            put the last item of line a of gMediaList into line a of tMediaNames
          end repeat
          mobilePick tMediaNames,1
          if the result > 0 then
            put the result into tMediaLine
    ...