charlesshoults
07-24-2009, 02:43 AM
I'm putting together a small site monitoring tool for AIR. It consists of four swf files and all communication is routed out through the primary file. (It's derived from a component I have on my website). In two of the swf's, I have defined this:
import flash.net.SharedObject;
public var so:SharedObject;
In the main file, I sets up some initial elements:
so = SharedObject.getLocal("battletechlive");
if(so.data.connectedUsername==undefined) { so.data.connectedUsername="guest user" }
if(so.data.connectedPassword==undefined) { so.data.connectedPassword="xxxxxxxx" }
if(so.data.userID==undefined) { so.data.userID=33 }
if(so.data.loggedInUser==undefined) { so.data.loggedInUser="guest user" }
if(so.data.admin==undefined) { so.data.admin=0 }
if(so.data.rememberLogin==undefined) { so.data.rememberLogin="no" }
if(so.data.autoLogin==undefined) { so.data.autoLogin="no" }
so.flush();
From what I understand, so.flush(), writes the variables to disk. I've also seen a post where the user put so.close() at the end. I've tried both ways. In the receiving swf, I perform the following on a tick interval of 60 seconds:
so = SharedObject.getLocal("battletechlive");
soDetail.text = so.size + " bytes";
mx.controls.Alert.show(String(so.size));
so.close();
For whatever reason, I always get 0. If I read so.size from the swf which pushed the data, I get 174. Help, please?
import flash.net.SharedObject;
public var so:SharedObject;
In the main file, I sets up some initial elements:
so = SharedObject.getLocal("battletechlive");
if(so.data.connectedUsername==undefined) { so.data.connectedUsername="guest user" }
if(so.data.connectedPassword==undefined) { so.data.connectedPassword="xxxxxxxx" }
if(so.data.userID==undefined) { so.data.userID=33 }
if(so.data.loggedInUser==undefined) { so.data.loggedInUser="guest user" }
if(so.data.admin==undefined) { so.data.admin=0 }
if(so.data.rememberLogin==undefined) { so.data.rememberLogin="no" }
if(so.data.autoLogin==undefined) { so.data.autoLogin="no" }
so.flush();
From what I understand, so.flush(), writes the variables to disk. I've also seen a post where the user put so.close() at the end. I've tried both ways. In the receiving swf, I perform the following on a tick interval of 60 seconds:
so = SharedObject.getLocal("battletechlive");
soDetail.text = so.size + " bytes";
mx.controls.Alert.show(String(so.size));
so.close();
For whatever reason, I always get 0. If I read so.size from the swf which pushed the data, I get 174. Help, please?