aspose file tools*
The moose likes Flex and the fly likes Flex and Java cannot add anything to list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Flex
Bookmark "Flex and Java cannot add anything to list" Watch "Flex and Java cannot add anything to list" New topic
Author

Flex and Java cannot add anything to list

Tim Sangster
Greenhorn

Joined: Mar 27, 2011
Posts: 12
I have been looking for hours why my ArrayCollection doesn't update after I add or delete an item.
I am trying to make a site to create read update and delete with flex, java and blazeds.
I can list the objects my model makes when it is created, changing anything after creation doesn't work.
If anybody has any ideas what I'm forgetting/ doing wrong I will be extremely thankfull.

Thank you!

Tim

The add function is called at line 22-23
The function itself is located at line 63-71 and the add function on the db is called on line 66.
My code:
Alvin Watkins
Ranch Hand

Joined: May 25, 2011
Posts: 53
I would make a few suggestions.

I would separate out the BlazeDS functionality from the player and visual elements. Make a BlazeDS object (I suggest you use ActionScript for that) and then it will be easier for you to see what you are sending to and receiving from the server.

I don't see in your ResultHandler (or anywhere else) where you are adding any new values to your ArrayCollection. Keep in mind that Flex is asynchronous. The way your code is designed, you could very well be looking for results to show up in the code that just are not there at the time you look for them - but get there later. Flex is not like Java (Java is synchronous). If I have two lines of code in Java, line B will not run until line A is done. If I try that in Flex, line B will run no matter what is going on with line A.

If you parse your functions into new objects, it will make it easier to put in Alert.show() messages to track your code from point to point and see where your problem is. You might put in an Alert.show('new_speler_var') where you are expecting that new var is being added to speler. That may be very revealing to you...
 
Don't get me started about those stupid light bulbs.
 
subject: Flex and Java cannot add anything to list