Solved

Flash, xml and real-time? Detecting XML file changes without reloading

Posted on 2006-07-05
7
255 Views
Last Modified: 2006-11-18
I'm trying to build an app that will know when an xml file has changed. This means that I am viewing a website and flash displays the changes without me refreshing the browser. I guess I need to know when an xml file has changed. What's the best way of approching this? XMLSocket?

Thanks in advance?
0
Comment
Question by:grzegorczyk
  • 4
  • 3
7 Comments
 
LVL 14

Expert Comment

by:dfu23
ID: 17043594
XMLSocket could do it but it is probably more hassle than what you are looking for ... because you must also implement a socket server application that you could communicate with. There are simpler ways of accomplishing what you want.

I think it is the LoadData functionality ... right? You can call a server side function (PHP, ASP, etc.) and check the modified date/time stamp of the file in question. If the date is newer than what you have then reload the XML document.

You can setup an interval to poll this every few seconds/minutes and dynamically refresh the data when needed.

Do you need some code examples? Specific questions?
0
 

Author Comment

by:grzegorczyk
ID: 17044394
would contstant interval slow down the app at all? code examples would be awesome, especially quarrying server side...


Thanks,

k
0
 
LVL 14

Expert Comment

by:dfu23
ID: 17044789
First off ... what server side functionality do you have (ASP, PHP, ASP.NET ...) do you know off-hand?

A constant interval would not slow you down at all unless you were doing it very frequently (like polling more than once a second) and the amount of data being returned was large ... I think what you want will not hinder your application at all.

Let me know what capabilities your server has and we'll go from there.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:grzegorczyk
ID: 17044937
Server is .NET most written in C#
0
 
LVL 14

Accepted Solution

by:
dfu23 earned 250 total points
ID: 17045933
In ASP.NET page (.aspx) you could use System.IO.FileInfo (http://msdn2.microsoft.com/en-us/library/system.io.fileinfo_members.aspx) to check the last write time ...

Call this however many seconds apart and keep track of the timestamp that is returned ... if it changes, reload your XML. I think that LoadVars is the best way to call the ASP.NET page ...

http://www.sephiroth.it/tutorials/flashPHP/loadVars/
0
 

Author Comment

by:grzegorczyk
ID: 17046455
Excellent, thanks a lot.
0
 
LVL 14

Expert Comment

by:dfu23
ID: 17047505
No problem ... best of luck with your project!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question