1 person found this helpful
There may be other ways to do it, but you could first download some sort of manifest file that listed the files and directories for the kiosk. You could could then walk through that list, downloading files and creating subdirectories as needed.
Thanks for the response Joe. I was thinking along the same line as your proposed solution as well, however, I'm not sure how to go about it. I assume I would need some server side script to return the remote directory structure and content list, correct? Unless there is a way to read the remote directory structure and content using AS?? If an AS solution is not possible can someone point me in the right direction for a server side solution?
Well, my ActionScript is a bit rusty/under used, so I could be wrong; but I don't think you can access the file/directory structures with ActionScript due to http/security issues. However, since there's a decent chance your server supports PHP, I'll tell you what I'd do:
or http://www.phpclasses.org/package/1431-PHP-Browsing-and-manipulating-directories-and-files .html (just two of the options available)
Sign-up/in, download either package and use that PHP class to build & echo JSON or XML output.
The first seems much more thorough and looks to have more options, but the second package seems more approachable and includes an example file that could easily be modified to suit your needs (probably even if you don't do PHP or HTML). It could be as simple as, find the name of the array that the data is collected in, placing the class on the server, pointing it to the correct folder, calling its execute method, & writing "echo json_encode($classInstance->structureArray)"
You could then consume the JSON/XML with an HTTPService call, build an Array/ArrayCollection and a method to recursively construct the absolute paths and download/create/overwrite each file and folder needed. (Make sure to create/overwrite any folders before you lace any files in them -- just a potential bug/pain I thought of)
You'd never need to have prior knowledge of what was changed, added, new directories/names, etc. You can filter by mtimes on either side of the call. Of course for security reasons, you'd probably want some sort of authentication to prevent people from being able to browse your server's folder structure & files. ...but that's a whole other topic.
Edit: You could also create a "file / folder service" by wrapping the class in another class that sets the options and retrieves the information exactly how you want it, then in FB 4+ you could have it inspect that PHP class and automatically create everything you need as a an ActionScript service class which would expose the PHP methods directly in your ActionScript using AMF. It'd be faster/lighter over HTTP than JSON or XML. Heck, you might not even need a wrapper class to create the file/dir service. I noticed that one of them appears to store the file & folder refs in seperate arrays. So if they already have, or you write, getters for those two arrays; you could just have FB 4 inspect the class I pointed you to above to create the service!
See also: http://tv.adobe.com/watch/adc-presents/working-with-php-services-in-flash-builder-4-part-1 / and http://tv.adobe.com/watch/adc-presents/view-the-code-php-services-in-flash-builder-4-part- 2/
Message was edited by: Chaos7703 I just remembered the new AMF features in FB 4+