Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-26-2006, 09:10 AM
Junior Member
 
Join Date: Jan 2006
Posts: 3
Default help! about "DataFile.load(file)"

//In swfkit
//Initialize
d=new Date();
dm=d.getMonth();
dd=d.getDate();
dnum=dm*100+dd;

exfile=File.exists("d:\\mmm.txt");
if (exfile==false){
DataFile.save("d:\\mmm.txt","dnum");
} //work

if (exfile==true){
olddnum=DataFile.load("d:\\mmm.txt");
} //not work

How can I load the data from the file?Please help me...
Reply With Quote
  #2 (permalink)  
Old 01-26-2006, 01:55 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:help! about "DataFile.load(file)"

The "load" method returns a boolean value that indicates whether the variables in the data file are load successfully. It works in this way:

Your data file contains a variable named "dnum". When you call the load method, it retrieves the name of the variable, which is "dnum", and the value of the variable, which is 100*month + date, for example, today is Jan 26, it is 126. Then the "load" method create a new variable named "dnum" in ffish script and assign 126 to the variable. In your script, the "dnum" exists before the load method, it just overwrites the value of the "dnum" variable with 126. So you would have to change your code as follows.

Code:
if (!File.exists("d:\\mmm.txt"))
{
var d = new Date();
var dm = d.getMonth();
var dd = d.getDate();
dnum = dm * 100 + dd;
DataFile.save("d:\\mmm.txt", "dnum");  
}    //work
else
{
// this method will set the value of "dnum" variable
DataFile.load("d:\\mmm.txt");  
  trace(dnum);
}
Reply With Quote
  #3 (permalink)  
Old 01-28-2006, 06:06 AM
Junior Member
 
Join Date: Jan 2006
Posts: 3
Default Re:help! about "DataFile.load(file)"

OH,thanks a lot!
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 02:13 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.