Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-27-2007, 05:29 PM
Member
 
Join Date: Nov 2007
Posts: 46
Default .ini file

how to write and read data from a .ini file???
Reply With Quote
  #2 (permalink)  
Old 12-28-2007, 08:04 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: .ini file

Please use the Ini object.
Reply With Quote
  #3 (permalink)  
Old 12-28-2007, 12:49 PM
Member
 
Join Date: Nov 2007
Posts: 46
Default Re: .ini file

can you pleasegive me an example???
Reply With Quote
  #4 (permalink)  
Old 12-28-2007, 02:28 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: .ini file

There are sample code in the ffish script manual, such as

Code:
//Read all sections from win.ini and write to demo.ini
var ini = new Ini("win.ini");
var demo = new Ini("Demo.ini");
var sect_names = ini.getSectionNames();
var i;
for (i = 0; i < sect_names.length; i++)
{
  var sects = ini.getSection(sect_names[i]);
  demo.writeSection(sect_names[i], sects);
}
Reply With Quote
  #5 (permalink)  
Old 12-29-2007, 02:43 PM
Member
 
Join Date: Nov 2007
Posts: 46
Default Re: .ini file

ok.
but how do you get the scrollspeed of this ini for example???
directory : c:\.
ini file:
Code:
### MAIN SETTINGS ###
&scroll_speed=10&         
&wii_mouse=true&          

### GRAPHICS SETTINGS ###
&fullscreen=false&         
&fullscreen_resolution=640x480&  
&fullscreen_colordepth=32&     

### INTERFACE SETTINGS ###
&show_time=true&          
&show_date=true&          
### AUDIO SETTINGS ###
&default_music=true&
Reply With Quote
  #6 (permalink)  
Old 12-29-2007, 05:50 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: .ini file

Your ini file seems to be malformed. Its content should be something like
Code:
[MAIN SETTINGS]
scroll_speed=10         
wii_mouse=true          

[GRAPHICS SETTINGS]
fullscreen=false         
fullscreen_resolution=640x480
fullscreen_colordepth=32    

[INTERFACE SETTINGS]
show_time=true          
show_date=true         

[AUDIO SETTINGS]
default_music=true
Then the following code can get the value of scroll_speed
Code:
var ini = new Ini("c:\\my.ini");
var scroll_speed = ini.getString("MAIN SETTINGS", "scroll_speed");
trace(scroll_speed);
Reply With Quote
  #7 (permalink)  
Old 12-30-2007, 03:31 PM
Member
 
Join Date: Nov 2007
Posts: 46
Default Re: .ini file

awesome ;D
just one more question:
how to write in this ini file that scroll_speed = 50 for example??
Reply With Quote
  #8 (permalink)  
Old 12-30-2007, 04:21 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: .ini file

Code:
var ini = new Ini("c:\\my.ini");
ini.writeString("MAIN SETTINGS", "scroll_speed", "50");
Reply With Quote
  #9 (permalink)  
Old 12-30-2007, 04:23 PM
Member
 
Join Date: Nov 2007
Posts: 46
Default Re: .ini file

awesome thanks
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:43 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.