Solved

Accessing root directory

Posted on 2008-10-10
8
1,146 Views
Last Modified: 2013-11-11
How do you access the root directory in flash when you are calling a file?

0
Comment
Question by:walker6o9
  • 4
  • 4
8 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 22693461
not sure what you mean?
give example
0
 
LVL 1

Author Comment

by:walker6o9
ID: 22705136
The folder that the .fla/swf/air resides in.
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 22708687
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 1

Author Comment

by:walker6o9
ID: 22717199
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
 
LVL 39

Expert Comment

by:blue-genie
ID: 22720046
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
 
LVL 1

Author Comment

by:walker6o9
ID: 22733337
I'm trying to get the DVD drive, not the hard drive.
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 22734837
yes but if you're running the app from the DVD you'll get that no?
0
 
LVL 1

Author Closing Comment

by:walker6o9
ID: 31505197
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question