ReloadResource()
Purpose #
Reloads a Notch resource. Can be used in conjunction with GetFileModifiedDate() to automatically reload a resource when it changes on disk. See the second example below.
Syntax #
bool ReloadResource();
Example #
function Update()
{
myResource = Document.FindResourceByName("myFile.csv");
if(myResource != null)
{
objRes.ReloadResource();
}
}
This example automatically reloads a resource that has changed on disk:
LastModifiedTime = 0;
function Update()
{
newModifiedTime = GetFileModifiedDate("c:\\myFolder\\myFile.csv");
if(newModifiedTime != null)
{
if(newModifiedTime > LastModifiedTime)
{
myResource = Document.FindResourceByName("myFile.csv");
if(myResource != null)
{
myResource.ReloadResource();
LastModifiedTime = newModifiedTime;
}
}
}
}