Q:

Loading question for actionscript

Can i do the following in actionscript-3? :
   I want to make an application that loads some images with a Loader by making URLRequests to a local folder. Can i build the application and include somehow this folder so when i send it from a server to a client the URLRequests operate normally on clients side? Also if this is possible, the folder may be not viewable/accessible by the client but only from the Flash application that comes with it?
 So for example, this piece of code that runs nicely, locally, to my machine, if i send it to a client will continue to run to its machine. Can somehow send the folder and the SWF as one object?
private function clothesOn( outfit:String ) {
   var clothier:Loader = new Loader();
   var item:String = "clothes/" + outfit + ".gif";
   var getItem:URLRequest = new URLRequest( item );
   clothier.load( getItem );
   this.addChild( clothier );
}

ps:code taken from actionscript design patterns.

A:

There's no way to send files to the client unless they're added as library assets in the flash file itself.
However, if the folder is on your server in the same relative location as it is on your local machine, and you instruct the flash file to make all paths relative to itself (using the base:'.' param) then the flash file should be able to find your image files without needing to send them to the client first.
The base param is a value you can specify when embedding your flash file in your page. See here: 
http://kb2.adobe.com/cps/127/tn_12701.html
Using SWFObject, the code would look something like this:
<script type="text/javascript">
    var params = {
        menu: "false",
        scale: "noScale",
        allowFullscreen: "true",
        allowScriptAccess: "always",
        bgcolor: "#FFFFFF",
        base:'.'
    };
    swfobject.embedSWF("file.swf", "divID", "706", "706", "9.0.0", "swf/expressInstall.swf", null, params, null);
</script>

Once that param is set, urls within your flash file will be relative to the location of the file itself. So assuming you have a structure like this on your server:
-root
  -index.html
  -file.swf
  -folder
    -img1.jpg
    -img2.jpg

a url like 'folder/img1.jpg' will be loaded by the flash file just fine.

