Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-31-2012, 02:50 PM   PM User | #1
hashamasgharSEE
New to the CF scene

 
Join Date: May 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
hashamasgharSEE is an unknown quantity at this point
Load Dynamic (constantly changing) XML Data to List in Flex

I have an XML file which changes after every one minute or precisely speaking data(nodes) in the XML are modified or added. I want to Display the simple XML data in a List which is refreshed automatically after one minute to reflect the changes. I am a newbie and i have very little knowledge about Flex so please Give me some code snippet so that i could run it and get some idea.
hashamasgharSEE is offline   Reply With Quote
Old 05-31-2012, 03:23 PM   PM User | #2
djpaul1963
New Coder

 
Join Date: Apr 2012
Location: Athens GR
Posts: 58
Thanks: 0
Thanked 6 Times in 6 Posts
djpaul1963 is an unknown quantity at this point
You can add a Timer object with the time span you need (let's say one minute) and get the XML again BUT you most probably face a caching problem where the XML contents will remain the same because the XML name didn't change.
There are 2 options for that. First, rename the XML (or add a parameter to its filename) but this option s valid only if you can administer the server or disable http caches in your code and cross your fingers to succeed because it's not always possible to persuade server with this.
A sample of what you need can be found here http://stackoverflow.com/questions/4...shot-test-code
djpaul1963 is offline   Reply With Quote
Old 06-01-2012, 06:13 AM   PM User | #3
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Quote:
Originally Posted by djpaul1963 View Post
BUT you most probably face a caching problem where the XML contents will remain the same because the XML name didn't change.
I don't think caching would be an issue(I have a similar process and I haven't seen it come up yet), because the Flash player isn't going to be wasting memory on caching unused data since it uses so much memory already. I could be wrong though in that assumption and it simply hasn't been a problem yet.

That being said, if you did run in to that problem you can simply append the timestamp or any random characters to prevent it from being cached.
Inigoesdr is offline   Reply With Quote
Old 06-01-2012, 04:08 PM   PM User | #4
djpaul1963
New Coder

 
Join Date: Apr 2012
Location: Athens GR
Posts: 58
Thanks: 0
Thanked 6 Times in 6 Posts
djpaul1963 is an unknown quantity at this point
The caching will not take place on the Flash player side but on the server, that's why I said he must add some parameter to the name (as you mentioned) and in most cases it's working, but not always, as some times the application server from the other side tries to undertand the parameters, resulting in a different dataset or a 'data not found' response.
I did faced this problem twice so far. In one occasion I managed to circumvent the problem by setting url request parameters to ask from the server to not use cache (and worked), but in the other occasion server just ignored my request so I was receiving the same data again and again (that's why the cross finger suggestion lol)

Last edited by djpaul1963; 06-01-2012 at 04:12 PM..
djpaul1963 is offline   Reply With Quote
Old 08-01-2012, 09:18 AM   PM User | #5
ruchiwebsol1
New to the CF scene

 
Join Date: Aug 2012
Location: India
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ruchiwebsol1 is an unknown quantity at this point
Hi there,

You'll want to probably do the equivalent of an AJAX call via Flex. I don't have it in front of me but I think you can use the HttpRequest object.

You'll basically have your object set up to retrieve the xml with a result handler on it. Whenever you need to call it, do so:

ActionScript Code:
myService.send();
and then you'll get your result via your handler:

ActionScript Code:
private function myResultHandler(event:ResultEvent):void
{
//do your handling stuff here....
}
obviously if you using things like ArrayCollections for drop downs and such, life will be a lot easier for you.

Hope that was at all helpful,
ruchiwebsol1 is offline   Reply With Quote
Reply

Bookmarks

Tags
flex, flex4.5, xml

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:42 AM.


Advertisement
Log in to turn off these ads.