Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Accessing root directory

Posted on 2008-10-10
8
Medium Priority
?
1,153 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

661 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