Solved

Accessing root directory

Posted on 2008-10-10
8
1,135 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
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now