Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
pwiop webforumsuser@macromedia.com #1
Saving an Array to a Shared Object
Hi Folks
(1) - Assuming I create an array as follows;
row1=new Array("One" , "Two" , "Three");
row2=new Array("Four" , "Five" , "Six");
row3=new Array("Seven" , "Eight" , "Nine");
myArray=new Array();
myArray[0]=row1;
myArray[1]=row2;
myArray[2]=row3;
(2) - I then wish to save this information to a shared object thus;
//onbuton event
mySharedObject = SharedObject.getLocal("savedData");
mySharedObject.data.savedArray=myArray()
mySharedObject.flush();
(3) - . . . and recall it at some later stage
//onbuton event
mySharedObject = SharedObject.getLocal("savedData");
trace(mySharedObject.data.savedArray[1][1]) - this should be "Five"
----
but something in point two and/or three above is obviously horribly incorrect - what do I do??
cheers - paul
pwiop webforumsuser@macromedia.com Guest
-
remote shared object array
Hi I'm haveing trouble with creating a array on the server side so far i have this code but i keep getting the error message this.myRSO has no... -
Convert Shared Object properties into ordered array
I need to put the shared object data (that contains the client names) into an ordered array. The following is NOT useful: for (var i in... -
Shared user object array
Maybe I am miss understanding this, but I have taken the sample_textchat application and have modified it slightly for my usage, I have got; ... -
webservice.htc and custom object array. only first object is deserialized in the result.value
Hello I've been using webservice.htc for 6 months or so with great results. recently i came into the following problem that I am not sure how to... -
[newbie]saving and reading array of associative array
i'm looking for examples of saving to file and reading back an array of associative array, in a ruby like way. saying i have something like : ... -
kglad webforumsuser@macromedia.com #2
Re: Saving an Array to a Shared Object
myArray is a 2-d array and you can only save variables in a shared object. so, in your shared object, you can save each element of your 2-d array (along with some identifying information) and recall and recreate your 2-d array when needed.
kglad webforumsuser@macromedia.com Guest
-
pwiop webforumsuser@macromedia.com #3
Re: Saving an Array to a Shared Object
so I cannot save 'row1' as it is to a shared object? I have to save each element of 'row1' separately
Then when I call each element I populate each array individually??
paul
pwiop webforumsuser@macromedia.com Guest
-
kglad webforumsuser@macromedia.com #4
Re: Saving an Array to a Shared Object
correct
kglad webforumsuser@macromedia.com Guest
-
pwiop webforumsuser@macromedia.com #5
Re: Saving an Array to a Shared Object
Hi Again
Oddly enough you can save each row to the shared object thus
mySharedObject.data.stageOneComplete = true;
mySharedObject.data.savedScore1 = row1;
mySharedObject.data.savedScore2 = row2;
mySharedObject.data.savedScore3 = row3;
mySharedObject.flush();
I noticed that if the closed brackets are included after each array, ie Row1() it does not work
on recall I just add each part to a new array thus;
myReturnArray = new Array();
myReturnArray[0] = mySharedObject.data.savedScore1;
myReturnArray[1] = mySharedObject.data.savedScore2;
myReturnArray[2] = mySharedObject.data.savedScore3;
and to my surprise and delight it works
no calling myReturnArray[1][1] does indeed return Five
pwiop webforumsuser@macromedia.com Guest
-
kglad webforumsuser@macromedia.com #6
Re: Saving an Array to a Shared Object
i didn't know that. btw, you can store your 2-d array:
so = SharedObject.getLocal("savedData");
so.data.savedArray=myArray;
and retrieve it:
so = SharedObject.getLocal("savedData");
myA=so.data.savedArray;
kglad webforumsuser@macromedia.com Guest
-
Unregistered #7
Re: Saving an Array to a Shared Object
Not sure how old this link is - but here is a method to store arrays into a sharedObject
var hostName:String = "savedData";
var testArray:Array = new Array("1","2","3");
var tierArray:Array = new Array();
tierArray.push({A:"Your", B:"Name"})
var severalItems:Object = new Object();
severalItems.item1 = "Information to Store";
severalItems.item2 = testArray;
severalItems.item3 = tierArray;
var mySo:SharedObject = SharedObject.getLocal(hostName);
mySo.data.mydata = severalItems;
mySo.flush();
trace(mySo.data.mydata.item1);
trace(mySo.data.mydata.item2[1]);
trace(mySo.data.mydata.item3[0].A);Unregistered Guest



Reply With Quote

