Expand my Community achievements bar.

Need help with Flex, BlazeDS and Spring

Avatar

Level 1
I have a configured Flex-Blaze-Spring application. I can call
a remote method on a Spring bean and pipe its results, (list of
pojos), to a DataGrid and the grid displays the data. The remote
object is defined with a <mx:> tag, defining a handler
function that pipes the result as ArrayCollection to the DataGrid's
data provider. I now want to perform another call to the remote
Spring bean, but this time define the remote object in
ActionScript, and pipe the results to a ArrayCollection variable
that I can then iterator thru and pick off values from attributes
of the objects in the ArrayCollection. I can't set access, my
collection seems to be empty. Here is some code:



public var gameRO:RemoteObject;

public var weeksGameList:ArrayCollection;



public function makePickGrid():void {

pickPanel.removeAllChildren();



var pickGrid:Grid = new Grid();

var gRow:GridRow = new GridRow();

var gItem:GridItem = new GridItem();

var cb:CheckBox;



gameRO = new RemoteObject();

gameRO.destination = "gameService";

gameRO.getWeeksGames.addEventListener( ResultEvent.RESULT,
getWeeksGamesResultHandler );

gameRO.addEventListener( FaultEvent.FAULT, handleFault );

gameRO.getWeeksGames( curWeek.selectedItem );

for each (var game:Object in weeksGameList) {

cb = new CheckBox();

cb.label = game.awayTeam;

gItem.addChild( cb );

gRow.addChild( gItem );

pickGrid.addChild( gRow );

pickPanel.addChild( pickGrid );

}

}



public function
getWeeksGamesResultHandler(event:ResultEvent):void {

weeksGameList = event.result as ArrayCollection;

}





What am I missing here? Thanks for any help!!



mik
1 Reply

Avatar

Level 1

Hello

This is a bit of a wild guess, but looking at the code, is it possibly related to the scope of cb?

Why not declare it inside the for loop, rather than outside it?