revUp - Updates and news for the LiveCode community
Issue 140 | September 21st 2012 Contact the Editor | How to Contribute

Opening a Stack from the Server
A handy technique to fetch data for your app, update users or refresh content.

by Karthik Sukumaran

This lesson shows you how to open a stack from a server using a desktop based standalone. This technique means you can download data to your application temporarily, administer updates to all your users via the server stack, or connect to other users by using a common stack from the server. It can also be used to reduce the standalone size and for a variety of other purposes.

You can download the sample stack for this lesson here.

Step 1: Create the Standalone Launch Stack

From this launch stack, we call the Main Application from the server using this code

on mouseUp
go stack url "http://karthiktest.on-rev.com/MainApplication.livecode"
end mouseUp

Step 2: Creating the main stack which will be opened from server

This is the Main stack which is uploaded to the server. Here we can also get the image from the server using on openCard:

on openCard
set the filename of image "city" to "http://karthiktest.on-rev.com/edinburgh_004p.jpeg"
end openCard

Please Note: This should be uploaded as a normal LiveCode stack and not as a standalone.

Step 3: Save the Launch stack as Standalone

Step 4: Upload the Main stack and Image to the server

As you can see we have uploaded the raw LiveCode file.

Step 5: Running the Standalone to get the stack from the server

Once we click the button "Get data from Web" the Main stack is opened.

That's it! Pretty simple, but a very useful technique to know.

About the Author

Karthik Sukumaran is a Technical Support Officer for RunRev Ltd. He has a passion for exploring and integrating new internet technologies.

 

Main Menu

What's New