reusing a urlloader after it fails due to IO_ERROR
hey everyone,
i have number of timers use refresh data our server using urlloaders retrieve xml files.
this works until pc running flash file has temporary dissconnect network. point forward, urlloaders throw io_error, after connection has been restablished.
i want able cleanly wait network issue resolve itself, , continue normal timer urlloading.
i wrote following in attempt suspend normal timed urlloaders until network connection restored:
// network monitor var networkmonitorxmlloader:urlloader = new urlloader(); networkmonitorxmlloader.addeventlistener(event.complete, networkmonitorxmllloaded); networkmonitorxmlloader.addeventlistener(ioerrorevent.io_error, networkmonitorxmlloadererrorhandler); var networkmonitortmr:timer = new timer(10000,0); networkmonitortmr.addeventlistener(timerevent.timer, checknetwork); networkmonitortmr.start(); function checknetwork(e:event = null):void { networkmonitorxmlloader.load(new urlrequest(\\server\share\file.xml)); } function networkmonitorxmlloadererrorhandler(e:event = null) :void { trace("off"); } function networkmonitorxmllloaded(e:event = null) :void { trace("on"); }
trouble falls prey same issue trying fix. can see running above code, changing path file exists on network, , watching outputs on console. 'on' approximately once every 10 seconds... next unplug ethernet cable. switch repeating 'off'. plug ethernet cable in. continue saying 'off' until stop it, after connection has been reestablished.
oddly enough, issue network files. if same thing wiht website instead, works supposed to... how fix this?
thanks!
- scott
when error, ready previous urlloader gc, create new urlloader , re-add listeners.
More discussions in ActionScript 3
adobe
Comments
Post a Comment