• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1155
  • Last Modified:

Accessing root directory

How do you access the root directory in flash when you are calling a file?

0
walker6o9
Asked:
walker6o9
  • 4
  • 4
1 Solution
 
blue-genieCommented:
not sure what you mean?
give example
0
 
walker6o9Author Commented:
The folder that the .fla/swf/air resides in.
0
 
blue-genieCommented:
i'm guessing you want to do this at runtime - so the fla won't be in the equation.
i remember in AS2 you could get the file path (browser) - AS3 not sure.
Air, here's a post
http://www.flex888.com/511/adobe-air-url-schemes-for-local-access.html
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
walker6o9Author Commented:
I tried that, but it gives me the path to the storage or app directories that are created in air.

Basically, I have the air files running on DVD's, and what I need to get the drive name that the DVD is in.  So far example, for most cases, this would be a D on an E.  
0
 
blue-genieCommented:
out of boredom of what i'm supposed to do, i went nosing around.
i think nativePtah of the fl.fileSystem package is what you require.
this returns the full path of the host system. you'll probably then need to do a substring of sorts to get the drive letter.

alternatively,
use relative paths?
use autorun - it won't care which drive.



import flash.filesystem.File;
 
var docs:File = File.documentsDirectory;
trace(docs.nativePath); // C:\Documents and Settings\turing\My Documents
trace(docs.url); // file:///C:/Documents%20and%20Settings/turing/My%20Documents

Open in new window

0
 
walker6o9Author Commented:
I'm trying to get the DVD drive, not the hard drive.
0
 
blue-genieCommented:
yes but if you're running the app from the DVD you'll get that no?
0
 
walker6o9Author Commented:
This is what I was looking for:

var rootDirs:Array = File.getRootDirectories();
for(i=0;(i< rootDirs.length; i++) {
   trace( rootDirs[i].nativePath)
}
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now