Loading Files

Top  Previous  Next

 

hm_clip0022

Adding a file to the resources of the application

Loading files, even those related to your own project has be done via the networking objects. For instance, if you want to load and display a text file you would do the following:

·Add the textfile to your project as a resource file
·The file will be stored in "res/[your_filename]" when you compile the project

You can now use the TW3HttpRequest object to load the file. Simply follow the instructions on how to use the TW3HttpRequest, and replace the URL with: FHttp.Get(‘res/somefile.txt’) to load in a textfile (for instance).

Most javascript based apps tend to add a "loading form" which takes care of loading in the most crucial elements. Creating common elements that deal with resource management is much easier in smart than it is under native javascript.