|
#include "NetServices.as"
#include "NetDebug.as"
// check - http://www.flash-db.com/remoting/?serviceID=14 for server code and updates.
// full code is located with the download - amfphp is needed to use this component.
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("loadImage");
}
myResult.onStatus = function(status){
trace("Error: " + status.description);
}
System.onStatus = myResult.onStatus;
// Create a connection to your gateway. (Make sure to change this line)
var conn = NetServices.createGatewayConnection("http:// path To /gateway.php");
// Specify the service you want to use. There has to be a file called 'swfBrowse.php' in your
// services directory.
var myService = conn.getService("swfBrowse", 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.browseSWF(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.browseSWF(childDir);
parentDir = directory;
currentDir = childDir;
}
// used to browse parent directories.
function browseParent() {
currentDir = parentDir;
// Call the service. Pass in the parent directory.
myService.browseSWF(parentDir);
}
// function to load images and swf's.
loadImage = function() {
var imgName = dirBox.getSelectedItem().data.fileName;
var imgLoc = currentDir+imgName;
trace(imgLoc);
loader.loadMovie(imgLoc);
}
|