desyphering input text variables

  • yuriythebest
  • Banned
  • Banned
  • User avatar
  • Posts: 143
  • Loc: Ukraine

Post 3+ Months Ago

Hi, my problem is this: I am making a flash rpg, and want to create a save/load game system, since cookies are unreliable and php/mysql demands it to be only online (or with a pc that has php configured, but honestly, how many casual ppl have that ?). I’ve come up with the idea of presenting users with an output code (string, number variables) which they can save into a text file and paste into the load dialog input text field later on. Outputting the variables is no problem, but I’m having problems making flash decipher what the user inputs back and making it flash-friendly again, for example I’m presenting the user with the following output text:

Somevar=34;
Good=3;
Something_else=23;
Name=”hero123”;
Abc=12;

How do I make a system that would allow a user to paste it into an input text field and for flash to use the variables (the actual variables stretch on for a page). I’ve tried the loadvars(), loadvariables() but they seem to need a txt file. thanks.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

Quote:
I’ve come up with the idea of presenting users with an output code (string, number variables) which they can save into a text file

Quote:
I’ve tried the loadvars(), loadvariables() but they seem to need a txt file.

;)

If you are set on using a paste method you can fill variables associatively like so.

Code: [ Select ]
var loadingArray = loading.text.split(";");

for(var item in loadingArray){
    var pair = loadingArray[item].split("=");
    _root[pair[0]] = pair[1];
}
  1. var loadingArray = loading.text.split(";");
  2. for(var item in loadingArray){
  3.     var pair = loadingArray[item].split("=");
  4.     _root[pair[0]] = pair[1];
  5. }


This example assumes there is a textbox with the instance name "loading" to enter the variables in.

Entering the string one=variable 1;two=variable 2;three=variable 3 into "loading" would set variables in _root named "one", "two", & "three" to their = counterparts.
  • yuriythebest
  • Banned
  • Banned
  • User avatar
  • Posts: 143
  • Loc: Ukraine

Post 3+ Months Ago

thanks!

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 10 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.