actionscript 3 - How to avoid the display of multiple alert windows in Flex -
i have timer in application. every 30 min, hit web services , fetch data , updates ui. application working fine till yesterday. suddenly, because of issue, web services not available time. during period, application displayed rpc error multiple times(more 100 alert boxes) in alert window. because of alert boxes, application hanged , not able anything.
i have tried several approaches, nothing worked.finally, have tried use flag. in approaches, looked promising. have implemented it.basically, in approach whenever open alert set flag.while opening , closing alert reset flag. didn't work expected. there approach, can in avoiding multiple alert windows.
please me, fix issue.
i write wrapper opening alerts, , use wrapper, not alert.show in code:
public class alertwrapper { private static var lastalert:alert; public static function showalert(text:string, title:string):void { if (lastalert) { popupmanager.removepopup(lastalert); //or //return; //ignore last alert } lastalert = alert.show(text, title, null, 4, onalertclose); } private static function onalertclose(event:closeevent):void { lastalert = null; } }
imports missing, hope idea clear.
Comments
Post a Comment