Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-14-2006, 01:03 PM
Junior Member
 
Join Date: Feb 2006
Posts: 7
Default Dialogs.fileOpen default path

Hi

When using Dialogs.fileOpen, is it possible to choose a default folder to show files from?

My program has the following structure:

Root folder-
.exe program
saves folder
source images folder

When selecting a source image to load, I'd like Dialogs.fileOpen to automatically show that folder. But when saving or opening a saved file, I'd like it to show the saves folder.

Is there a way of doing this?
Reply With Quote
  #2 (permalink)  
Old 04-14-2006, 01:35 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Dialogs.fileOpen default path

By setting the default file, the file open dialog box will go to the folder contains the file. But if the folder does not exist, the fileOpen method will fail. So we do it like this:

Code:
var defaultFile = getAppDir() + "Source Images";
if (Folder.exists(defaultFile))
{
Dialogs.fileOpen("Jpeg images(*.jpg)|*.jpg|", 
"jpg", defaultFile + "\\demo.jpg");
}
else
{
Dialogs.fileOpen("Jpeg images(*.jpg)|*.jpg|", "jpg");
}
Reply With Quote
  #3 (permalink)  
Old 04-14-2006, 02:16 PM
Junior Member
 
Join Date: Feb 2006
Posts: 7
Default Re:Dialogs.fileOpen default path

Thanks for the reply. However, for some reason the Dialogs.fileOpen is not returning a value when contained in the if statement. This is my code

var defaultFile = getAppDir() + "saves";
if (Folder.exists(defaultFile))
{
var fileLocation = Dialogs.fileOpen("CCG files(*.ccg)|*.ccg|", ".ccg", defaultFile + "\\example.ccg");
}
else
{
var fileLocation = Dialogs.fileOpen("CCG files(*.ccg)|*.ccg|",".ccg","");
}
DataFile.load(fileLocation);


fileLocation returns as undefined. However when I try:

var fileLocation = Dialogs.fileOpen("CCG files(*.ccg)|*.ccg|",".ccg","");
DataFile.load(fileLocation);


or even:

var defaultFile = getAppDir() + "saves";
var fileLocation = Dialogs.fileOpen("CCG files(*.ccg)|*.ccg|", ".ccg", defaultFile + "\\example.ccg");
DataFile.load(fileLocation);


The correct value is returned. I see no reason for this, maybe you can help.
Reply With Quote
  #4 (permalink)  
Old 04-14-2006, 02:52 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Dialogs.fileOpen default path

Please do not use "var" in the if statement, because it defines a local variable, which is undefined out of the if statement.
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:39 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.