heres some code snippets...

-------------------
server side script:
-------------------

application.onAppStart = function()
{
NetServices.setDefaultGatewayUrl("http://localhost:8080/achilles-
2/amfgateway/");
gatewayConn = NetServices.createGatewayConnection();

issuesService = gatewayConn.getService("packageName.className", this);

this.so = SharedObject.get("so",true);

getData();
}

function getData()
{
trace("getData called");
// This function returns an ArrayList of objects
myService.getIssueList();
}

application.getIssueList_Result = function(val)
{
trace("got a result from getIssueList");
trace("Result:"+val.length);

this.so.lock();

var issuesArr = new Array();

for(var j=0; j < val.length; j++)
{
issuesArr.push(val[j]);
}

this.so.setProperty("issueList", issuesArr);

trace(issuesArr.length);

//this.so.setProperty("issuesList", issuesArr);

this.so.unlock();
}


-------------------
client side script:
-------------------

var issues_so: SharedObject;
var client_nc : NetConnection;

function initIssues()
{       
client_nc = new NetConnection();
client_nc.onStatus = function(info)
{
mx.controls.Alert.show("Level: " +info.level+ " 
Code: " +info.code);
}

client_nc.connect("rtmp:/achilles2/room_1");

so = SharedObject.getRemote("so",client_nc.uri, true);
so.connect(client_nc);  

so.onSync = function(list)
{       
trace("onSync:");
for (var i=0; i < list.length; i++)
{
trace(i+":"+list[i].name+","+list[i].code);
}

updateList(this.data.issueList);
}

function updateList(res)
{
// This returns the correct amount of objects in the 
list
mx.controls.Alert.show("issueList length: " 
+res.length);
// This line doesnt do anything
dgIssue.setDataProvider(res);

for( var i in res)
{
// Im unable to retrieve any attributes from 
each object
var obj= res[i];

this.dgIssue.dataProvider.addItem(obj);
}

// This returns a blank
mx.controls.Alert.show
(dgIssue.dataProvider.length, "dataprovider length");   
}
}




Reply via email to