Creating a non-interactive status display: I want to have the flash display
reflect data in a server-based XML-file. So far this is easy. But I want the
display to change everytime the XML file changes-- in order to reflect status
changes. I've used an XMLConnector and specified it and the trigger in the
first frame. The Flash code catches and shows the XML values initially . But
when I edit the XML file, the new values are never picked up by Flash- its
almost as though the values are cached. How do I get Flash to regularly be
updated from a changing XML file? I've also tried putting the trigger in a
loop- but that doesn't work either.
MotionMaker - 05 Dec 2006 20:24 GMT
Try adding a random value to the load method argument. You might use "my.xml?" + getTimer() or you can use something more savy with the Math.random in combination with getTimer().
Scott Johnson - 07 Dec 2006 14:06 GMT
What does that do, force the page to regenerate itself, preventing the
cached page from loading?
> Try adding a random value to the load method argument. You might use "my.xml?" + getTimer() or you can use something more savy with the Math.random in combination with getTimer().
MotionMaker - 07 Dec 2006 17:38 GMT
Reply to your email
Sorry I missed you are using the XMLConnector component. Have no real
experience with the XMLConnector to advise you on caching issues. But with the
XML object, the load method file name argument is often appended with a time
value to help fool the cache. Perhaps you can find a similar solution.
levrek1 - 08 Dec 2006 00:09 GMT
I DID find a solution with setInterval, but there is still a problem of a
diffeent sort.
When using XMLConnector, it appears that XMLConnector.trigger() is the thing
that goes out and gets new data from the server. so:
function checkForData():Void {
myXML.trigger();
<<handle new values of bound data>>
};
var intervalID:Number = setInterval(checkForData, 10000);
works very well by executing the trigger every 10000 timeunits. This all
works when run in the Flash Player. However, if I embed the thing in a webpage
(with either FireFox or IE7 or 6), It stops triggering after the first time.
Interestingly if I also run the Flash Player version, then the web version
keeps updating, but stops if I kill the Player. So, I'm wondering: whats up
with this?
MotionMaker - 08 Dec 2006 20:02 GMT
Again not up-to-date on XMLConnector but common sense says you cannot handle
external data on the code line following the request for it. Rather there needs
to be a call back function where this happens.
levrek1 - 11 Dec 2006 02:36 GMT
Thanks for your help, but its still not working. The documentation on
XMLConnector never mentions anything about needing a callback function. I
assumed it was handled, somehow, in the component. Nonetheless, I created one
with AddEventListener. I get the event and deal with it. However, just as
before, it seems to work fine in the standalone flash player but not when the
Flash is in a webbrowser- in the browser it checks the data once and gthen
stops. I have tested the setInterval() with a Flash-local function andthe
local ones work fine, so it seems pretty clear that the problem is repeated xml
reads on a remote server from a webbrowser. Can this be made to work??
MotionMaker - 12 Dec 2006 15:38 GMT
I see two events in the docs. Perhaps the one you need is http://livedocs.macromedia.com/flash/8/main/00004315.html
levrek1 - 13 Dec 2006 19:22 GMT
OK, so I found th issue- its the browser. What I have been doing works
perfectly fine in FireFox. However, IE7 (haven't yet tried other IE versions)
seems to do some strange caching or has a security scheme that prevents
repeatedly hitting the same .php file to get data. Its either the browser or
the flash player for IE
MotionMaker - 14 Dec 2006 13:48 GMT
Perhaps if you are using AS to work the XMLConnector you can try adding a
random variable to the URL
myXMLConnector.URL = "http://domain/thefile.php?" + getTimer();
Again I do not use XMLConnector, but this is what is frequently done as one
way to overcome caching issues.