|
/* This uses a custom component, download the source files at the bottom to get the component */
#include "NetServices.as"
#include "NetDebug.as"
myResult = new Object();
myResult.onResult = function(result){
dirBox.removeAll();
for (i=(result.fileSize.length-1);i>=0;i--) {
fileName = result.fileName[i];
fileSize = result.fileSize[i];
fileDate = result.fileDate[i];
fileType = result.fileType[i];
// Configure Data Provider for Custom List Box
var directoryData = { fileName:fileName,fileSize:fileSize,fileDate:fileDate,fileType:fileType };
// Add Items to the custom list Box
dirBox.addItem(fileName, directoryData);
}
//dirBox.setChangeHandler("doSomethingWithSelectedFile");
}
myResult.onStatus = function(status){
trace("Error: " + status.description);
}
System.onStatus = myResult.onStatus;
// Create a connection to your gateway.
var conn = NetServices.createGatewayConnection("http:// pathTo /gateway.php");
// Specify the service you want to use. There has to be a file called 'filebrowse.php' in your
// services directory.
var myService = conn.getService("directoryBrowse", myResult);
// Set up the base directory. This is the directory where you start browsing from. It is relative from the
// flashservices directory.
var directory = "../../SomeDirectory/";
var parentDir = directory;
var currentDir = directory;
// Call the service. Load the initial directory map.
myService.browseDirectory(directory);
// Function used for browsing lower directory's.
function browseChild(dir) {
// dir is passed in from a button in the component.
childDir = currentDir+dir+"/";
// Call the service.
myService.browseDirectory(childDir);
parentDir = directory;
currentDir = childDir;
}
// used to browse parent directories.
function browseParent() {
currentDir = parentDir;
// Call the service. Pass in the parent directory.
myService.browseDirectory(parentDir);
}
|