Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-22-2008, 03:42 PM
Junior Member
 
Join Date: Oct 2008
Posts: 7
Default A problem with DataFile.save... or not?!

Hi, everyone...
A weird thing is happening here with my scripting. When I write this...
Code:
//Initialize

var playerName = "something";
var file = "D:\\player.txt"; 
DataFile.save(file, "playerName");
Dialogs.msgBox(getAppDir());
getAdditionalFile()
return true;
Everything works just perfectly... I get a file on disk D and get a message box for testing. But when I want to use it as a function, like...
Code:
//Initialize

function saveInfo(){
	var playerName = "something";
  var file = "D:\\player.txt"; 
  DataFile.save(file, "playerName");
  Dialogs.msgBox(getAppDir());
};
saveInfo();
getAdditionalFile()
return true;
even when I call saveInfo() function from within flash, all the same, I get a message box with the supposed message but no file on disk D.
What is the reason?
Is it impossible to use DataFile commands in a function? I don't believe it can be true. But nothing else comes to my mind.

Thanks in advance.

P.S. I've used SavedObject class... still useless. And I've set password for encryption in Resources.
Reply With Quote
  #2 (permalink)  
Old 11-22-2008, 05:54 PM
Senior Member
 
Join Date: Feb 2003
Posts: 212
Default Re: A problem with DataFile.save... or not?!

I noticed that saving to datafile for some reason doesn't work with vars that are declared with var.
When I tried this, it worked:

Code:
//Initialize

function saveInfo(){
  playerName = "something";
  var file = "D:\\player.txt"; 
  DataFile.save(file, "playerName");
  Dialogs.msgBox(getAppDir());
};
saveInfo();
getAdditionalFile()
return true;
Reply With Quote
  #3 (permalink)  
Old 11-23-2008, 08:08 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: A problem with DataFile.save... or not?!

Thank u, meester. Yes, it works only with global variables. a "var" variable inside a function cannot be accessed by "DataFile".
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 05:26 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.