Skip to main content
Inspiring
October 18, 2006
Question

RSO Array

  • October 18, 2006
  • 5 replies
  • 753 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?
    This topic has been closed for replies.

    5 replies

    Inspiring
    October 19, 2006
    just connected to the SO after i defined onsync ........wasn't necessary but still you are right and i consider your suggestion a good programming practice.
    October 19, 2006
    You should define your onSync method before you connect to the SO. That will save you a lot of headaches.
    Inspiring
    October 19, 2006
    I fixed it I fixed it.........for some reason 1 slot of the stored array was in ....SO.data.slot[0]....and the other slot of the stored array was in SO.data.slot[1].....i'm a little baffled so i'll just call this unkown work around.
    Inspiring
    October 19, 2006
    I fixed it I fixed it.........for some reason 1 slot of the stored array was in ....SO.data.slot[0]....and the other slot of the stored array was in SO.data.slot[1].....i'm a little baffled so i'll just call this unkown work around.
    Inspiring
    October 19, 2006
    here is the code i'm attempting to use.

    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 timer
    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;
    October 18, 2006
    Let's assume your array is saved in an SO property named "myArray"

    On the client side

    myArray = my_so.data.myArray;

    or

    myVar = my_so.data.myArray;

    on the server side:

    myArray = my_so.getProperty("myArray");
    myVar = myArray;

    Inspiring
    October 19, 2006
    well that doesn't work....here is how i attempt to access the array using the method you mentioned below.....SO.data.slot0.theTime[0]; ........but that always traces as undefined but if i trace....... SO.data.slot0; .....then the array displays just fine but i can't access its data.