Solved

Accessing root directory

Posted on 2008-10-10
8
1,150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
Google Chrome Blank White Screens 13 311
video live streaming 1 129
Include Adobe AIR libraries in Flash Builder 4 159
Flash Media Live Encoder unreliable encoding start 2 102
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

752 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