|
|||
|
Problem with exists and creats folder???
Code:
// Exernaling from flash player:
var scf = FlashPlayer.getVariable("myXMLText");
// Instancing to all important events and functions:
var appdataDir = getAppDir("%appdata%");
var smfolder = new Folder("SnakeMedia");
var smCfgfolder = new Folder("Configures");
var file = new FileStream("config.scf", "w");
// If folder does not exist:
appDataDir.path;
if(smfolder == 0)
Folder.exists(appdataDir.smfolder);
else if(smfolder = 1)
appdataDir.d = new Date(smfolder.dateCreated);
....
file.writeLine('<?xml version="1.0" encoding="UTF-8"?>');
file.writeLine(scf);
file.close();
Output: C:\Documents & Settings\<Username>\Aplication Data\ SnakeMedia \Configures \config.scf %appdata% = C:\Documents & Settings\<Username>\Aplication Data\ How do we fix problem?`Best regards, SnakeMedia |
|
|||
|
|
|
|||
|
Quote:
Do not fake us! I say admins.. BVest regards, SnakeMedia |
|
|||
|
There is no property that can represent the string text of a XML object, so you have to save the string text of it in another variable in action script. And in your code, the variable or property "myXML.text1" doesn't exist at all, so it cannot work.
|
|
|||
|
Quote:
But i know about File and FIleStream by Adobe Air is very smiler than SWFKit?? I do no know - YOu want to make sure with Code:
private var configFile:File = new File();
private var fStrm:FileStream = new FileStream();
private var configData:XML = new XML();
// load configuration data from XML file
private function loadConfig():void
{
// resolve the file path of config file
configFile = File.applicationStorageDirectory.resolvePath("config.xml");
// incase file doesn't exist copy to storage directory
if(!configFile.exists)
{
configFile = File.applicationDirectory.resolvePath("config.xml");
configFile.copyTo(File.applicationStorageDirectory.resolvePath("config.xml"));
}
// create a file stream object to read config file
fStrm = new FileStream();
// read config
fStrm.open(configFile, FileMode.READ);
// getting XML content
configData = XML(fStrm.readUTFBytes(fStrm.bytesAvailable));
// change skin
changeSkin(configData.skin);
// close file
fStrm.close();
}
But we must to learn with SWFKit with 2 different ways like AS3 and Fishscript 3.x AS3: private function loadConfig():void { fscommand"fish_run", "loadcfg"); }; Fishscript: var cfgFile = new File("%appData%\\SnakeMedia\\Configures\\config.xm l"); var cfgFileStream = new FileStream(cfgFile , "r"); var cfgDateXML = new XML(); // If folder does not exist: cfgFile = File("%appData%\\SnakeMedia\\Configures\\config.xm l"); if(cfgFile.exists){ cfgFile = File("config.scf"); cfgFile.copy(File("%appData%\\SnakeMedia\\Configur es\\config.xml")); } And UpdateConfig will to write once config.xml. Than it will to work - if config.xml into C:\\Documents & Settings\\<Username>\\Application Date\\ SnakeMedia \\ Configures \\ config.xml ??? Can not work? Is it posible because File(Folder or Specialfolder) can not work... Why does it not? We need to example for File and FileStream?? Best regards, SnakeMedia Last edited by snakemedia; 11-15-2009 at 01:04 PM. |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|