Skip to main content
Inspiring
October 19, 2006
Question

still no answer

  • October 19, 2006
  • 4 replies
  • 484 views
hi I have an array stored in a remote shared object except i don't know how to get the array out of the remote shared object and use it. How do i get the array and use it?.....what causes access.text = SO.data.slot0.array0[0]; ........ to fail and display undefined?


client_nc = new NetConnection();
client_nc.onStatus = function(info) {
trace("Level:" + info.level + newline + "Code: " + info.code);
}
client_nc.connect("rtmp:/RSO");
SO = SharedObject.getRemote("data0", client_nc.uri, false);
SO.connect(client_nc);
SO.onSync = function(list) {

for ( var i = 0; i < list.length; i++ )
if ( list .name == "slot0" && list.code != "success")
{
array0 = SO.data.slot0;
break;
}
};
start_btn.onPress = addarray;
function addarray() {
SO.data.slot0 = array0;
slot0.text = SO.data.slot0;
access.text = SO.data.slot0.array0[0];
}
var array0 = new Array();
var minsxxx = 1;
var secsxxx = 2;
array0[0] = minsxxx;
array0[1] = secsxxx;
    This topic has been closed for replies.

    4 replies

    Inspiring
    October 19, 2006
    slot0 is the name of the slot in the remote shared object i wish to use...in case i want to store somthing else in slot1 or slot2 or whatever a remote shared object is similar to an array in the way it stores information.....in my case a slot in an array storing an array.
    October 20, 2006
    for ( var i = 0; i < list.length; i++ )
    trace("minsxxx:"+SO.data[list.name][0]);
    }

    what you want to try, in my view, is that : SO.data["slot0"][0]. I most warn you that depending of your application, using complex data in a shared object(object, array....) might slow down your app and increase the message number and data send to users. If your application doesn't interact with a lot of people you can continue on your way otherwise you should revise your design(your code) to simplify properties in the SO like this example.

    It is important to understand that when you updated a SO propertie ALL THE DATA in this propertie is send to every SO connected user. If you look at the example the good one will send only a number, string... and the bad one will send a array of data. This can be a major problem.


    examples :

    Good
    mySO [
    firstProp: value;
    secondProp: value;
    ....
    ]

    Will work but...
    mySO [
    firstProp : [minsxxx, secsxxx, .....]
    secondProp: [...]
    ]


    I hope this can help you and understand my poor English(I'm a French developper).
    Inspiring
    October 20, 2006
    Yes you are correct and i've had the same thought .....for now i'm leaving it the way it is but in the future i will simplify the SO....good eye for code you have ...take care my french friend
    Inspiring
    October 19, 2006
    pleas don't respond unless you have a definte answer......all this maybe stuff is driving me crazy.
    Inspiring
    October 19, 2006
    slot0 is the name of the slot in the remote shared object i wish to use...in case i want to store somthing else in slot1 or slot2 or whatever a remote shared object is similar to an array in the way it stores information.....in my case a slot in an array storing an array.
    Inspiring
    October 19, 2006
    Try storing back in Array first and then calling array0[0]; because [ ] might have different meaning depending on context. Why you are even doing this SO.data.slot0.array0[0]? suppose to be SO.data.slot0[0]