Copy link to clipboard
Copied
Hi. I am playing with Flash Builder 4 (so excuse my ignorance).
I'm trying to connect to a Twitter data source for a test and the results are returned in JSON format. I then want to loop through all the tweets returned, showing each one for five seconds. I am trying to get this example working through actionscript and through the connect to the Data/Services wizard. Connecting and returning the results isn't a problem but I can't find any examples showing how to move through the records one at a time (using the Timer event). I'd love to get this working using the Data/Services wizard approach but all the examples I have found are all about binding to a datagrid (or similar) and I can't find anything showing how you can get your results and display one record at a time.
Can anybody point me in the direction of an example or give me an idea of how to do this?
Apologies for the ignorance. Any help greatly appreciated (I hope the above makes sense).
Cheers.
Copy link to clipboard
Copied
I haven't done this, so this may not be the best way, but how about:
When data returns:
1. put the results into a public global ArrayCollection acElements
2. set a public global variable totalElements
3. set a public global variable elementIndex=0
4. start the timer
When the timer event fires:
1. display what is in acElements[elementIndex]
2. increment elementIndex by 1
3. if elementIndex >= totalElements then set elementIndex back to 0
It occurs to me that this is a snapshot and you may be talking about real-time streaming data, but perhaps this will help. I suppose you could restart this process on a second timer, every few minutes?