Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-01-2007, 02:41 PM
Junior Member
 
Join Date: Jun 2007
Posts: 8
Default Load a variable into a dynamic text box!

Hi everyone, I need some assistance again.

I have a game project that needs your assistance. I have a swf file with a dynamic text box that needs to load a player name from a text file saved from the SWFKIT published exe file.

I have read the documentation but cannot for the life of me figure out how to load in the name.

The save script works fine and writes a txt file to disk in the same directory as the exe.

This is the initialize script I have so far.

\\Initialize
function Name (playerName)
{
this.playerName = playerName;
}
NameRecord = [];
var NameFile = getAppDir() + "\\playerName.txt";
Datafile.load(NameFile)

for (i = 0; i < NameRecord.length; i ++)
{
var player =NameRecord[i];
trace(player.playerName)
}

Sometimes I get a warning saying I have "using undefined property "playerName"", other times I get a warning saying "using undefined property "length"", or I do not get an undefined message as the trace result.

So if anyone can help me load the playerName from the txt file into the textbox I would be eternally greatful.

David
Reply With Quote
  #2 (permalink)  
Old 08-02-2007, 10:50 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Load a variable into a dynamic text box!

Could you please send us your project (to support@swfkit.com)? With only the above code, it is very hard for us to find out where the problem is. Thank you.
Reply With Quote
  #3 (permalink)  
Old 08-03-2007, 09:39 PM
Junior Member
 
Join Date: Jun 2007
Posts: 8
Default Re:Load a variable into a dynamic text box!

Hi I have sent a simplified version of the files to you.

Thanks for your help.
Reply With Quote
  #4 (permalink)  
Old 08-05-2007, 12:34 PM
Junior Member
 
Join Date: Jun 2007
Posts: 8
Default Re:Load a variable into a dynamic text box!

Hi guys the files worked perfectly I only have one other sleight problem. I assumed that DataFile.save and DataFile.saveAndEnc code where pretty much the same. When I changed the saveName script to this:

var playerName = FlashPlayer.getVariable("_root.playerName");
var playerRecord = new playerInfo(playerName);

function save()
{
var file = getAppDir() + "\\playerName.txt";
DataFile.saveAndEnc(file, "playerRecord");
}
{
save();
}

The file no longer writes to disk. Any suggestions. Thanks again
Reply With Quote
  #5 (permalink)  
Old 08-06-2007, 02:03 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Load a variable into a dynamic text box!

Please set the "file encryption password" in "Resources" panel. The "saveAndEnc" method use that password to encrypt the data files. And please use "loadAndDec" method to load the encrypted data file.
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 04:28 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.