Issue with Multiple Text Fields and SharedObject Storing

Posted by user1662660 on Stack Overflow See other posts from Stack Overflow or by user1662660
Published on 2013-07-01T16:19:06Z Indexed on 2013/07/01 16:20 UTC
Read the original article Hit count: 239

Filed under:
|

I'm currently working on an AIR for iOS application in Flash CS6. I'm trying to store multiple pieces of data from various text inputs; i.e "name_txt", "number_txt" etc.

I have the following code working for a local save file;

import flash.events.Event;
import flash.desktop.NativeApplication;
import flash.events.Event;


var n1:String = so.data.Number1;
var so:SharedObject = SharedObject.getLocal("TravelPal");

emerg1.text = n1;

emerg1.addEventListener(Event.CHANGE, updateEmerg1);

function updateEmerg1 (e:Event):void 

{
so.data.Number1 = emerg1.text;
so.flush();
}



NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExit);

function onExit(e:Event):void
{
so.flush();
}

Now as soon as I create multiple text inputs and attempt to store them in my SharedObject, the whole system just falls apart. None of the text gets saved, even the previously working ones.

I'm pretty new to ShardObject usage. What am I missing here? Is this a good way to go about storing multiple text inputs?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flash-cs6