Humanities Home page   Office of Digital Humanities
Back     BYU LiveCode Lessons Gateway

DigHT 310
In-class Exercise:
Exploring LiveCode's Internet Capabilities

Using the htmlText property and the URL keyword.

1. Create a new stack. Remember to give it an appropriate name and title, then save it. On the first card create a large scrolling field called "webcontent" and a small field called "urlfield". Create a button called "displayWebText" and add a mouseUp handler that will display styled web text from the URL indicated in the url field in the large web content field. This is done very simply by using the URL keyword and setting the htmlText of the field:

put fld "urlfield" into fileURL
set the htmlText of fld "webcontent" to url fileURL

For this and all other items in this exercise, make sure the url field has a fully qualified web URL in it—i.e., the entire URL, including the http:// protocol prefix.

Using web-based media resources in your LiveCode stack.

For the next few exercises remember that our DigHT 310 file server doubles as a "practice" web server. (AKA http://chum310.byu.edu.) There is a folder there called "media" that holds various types of media files. You may use files in this folder for the following exercises. (Of course, if you know of other web sites with appropriate media files you are welcome to use those.)

Just to be clear: All of the URLs in the following exercises should be http:// URLs.

2. Create another card with an empty image object, a URL field and a button. The button's mouseUp script should change the contents of the image object to display the image file located at the URL in the url field. The key is to:

set the filename of image "myimage" to fld "urlFld"

3. Create another card with a button called "play" and a URL field. Write a mouseUp handler in the button that will play internet-based audio files. Use the form:

play url fld "urlfld"

Keep in mind that the play command only works with uncompressed audio.

4. Create another card with an empty QuickTime player object, a url field and a button. The button's mouseUp script should change the contents of the player object to display the image file located at the URL in the url field. This process is nearly identical to the process for showing images in image objects:

set the filename of player "myplayer" to fld "urlFld"

5. Now create another card with a new button called "gostack" and a URL field. Write a mouseUp handler that will open a stack located on the DigHT 310 web server. The url field should contain an http URL that references any stack on the server (for example, any stack in the Keys folder or a stack in your student folder.) Then use:

go to stack URL fld "urlfld"

When you are done, turn your stack in to the homework drop folder. Be sure to name your stack so the instructor knows whom it belongs to.


Back     BYU LiveCode Lessons Gateway
Maintained by Devin Asay.
Copyright © 2005 Brigham Young University