Shared Objects & WDDX! Star-crossed Lovers?

Hello all,

I’m trying to load some WDDX data into a shared object, but I’m having some troubles getting it back out…

I can open the sol file in a text editor and see that my data is in there, but I can’t manage to access it… does putting information into a sharedObject change things? Can you load an array into a sharedObject and have it retain it’s array-ed-ness?

Further details may be furnished upon request! Thanks in advance!

lrhb :hat:

You can’t store an array into a shared object… but you can create a string from the array by using the [font=courier new]Array.join()[/font] method, store the string into the shared object, and then use the [font=courier new]String.split()[/font] method to create an array from the string. :slight_smile:

Confused? Here’s an example:

// store it
var my_array = [1, 2, 3, 4, 5];
var my_so = SharedObject.getLocal("my_so");
my_so.data.my_str = my_array.join();
my_so.flush();
// retrieve it
var my_so = SharedObject.getLocal("my_so");
var my_array = my_so.data.my_str.split(",");

Ah-haaah!

Very very sneaky, Kode! I’ll give that a go! Thank you for sharing your secret wisdom! :slight_smile:

lrhb :hat:

No problem, hope you can work this out. :wink:

Hrrrrm!

I am still having some troubles… I think the information I’m trying to save and then access is a little too complicated for me to use this solution?

What I’m trying to save is a WDDX Recordset which contains many arrays… could I use multiple delimeters?

Here’s my actionScript, in case I’m doing something terribly wrong :slight_smile:

[AS]#include “wddx_mx.as”

someWDDX = SharedObject.getLocal(“someSOL”);

converter = new WDDX()
urlXML = new XML();
urlXML.onLoad = function(){
containerWDDX = (converter.deserialize(urlXML));
trace(containerWDDX.getRowCount());

containerWDDX.data.arrayInfo = containerWDDX.join();
containerWDDX.flush();

var newContainerWDDX = SharedObject.getLocal("someSOL");
var reconstructedWDDX = newContainerWDDX.data.arrayInfo.split(",");

trace(reconstructedWDDX);
trace(reconstructedWDDX.storeInfo.getRowCount());

}

urlXML.load(“load from this URL”);[/AS]

thanks in advance!

lrhb :hat:

What do you mean exactly by multiple delimiters? :-\

You can use any delimiter you want… the [font=courier new]Array.join()[/font] defaults to a comma, but you can change it to anything you like. :slight_smile:

var a_array = [1, 2, 3, 4, 5, 6, 7];
var a_str = a_array.join("<splithere>");
var b_array = a_str.split("<splithere>");

Oh, you know, multiple delimiters… like snozzberries, and vernicious knids! :crazy:

But no… I’m not surehow to describe the arrangement of data I’ve got, so,since we’re all visual people (right!) I decided to make an illustration!

How might I be able to split that up using delimiters?

Thanks in advance, and thanks for your patience!!

lrhb :hat: