So i have several SWFs in this project and i need to find a way to ensure that only a single instance of one of these SWFs can load.
For example, you cannot open 2 different application SWFs in 2 different browsers, or tabs on the same computer at the same time.
LocalConnection seemed to be the best solution to this problem, however, we are experiencing problems with Internet Explorer 9.
private var lc:LocalConnection = new LocalConnection()
try
{
lc.connect ("Main");
//continue
}
catch (e:Error)
{
//swf exists.
}
It seems IE9 specifically seems to not destroy the SWF instantly. Refreshing a page can show "Swf Exists" and several seconds later, a refresh fixes the problem.
Does anyone know why this happens?
In failing that. Does anyone know if there is a Exit event? For example, when the SWF is terminated, is there a way i can catch that event and manually close down the local connection before termination?
onApplicationExit(e:Event): void
{
lc.close();
}
Finally, does anyone have any other methods i could use to try to achieve a single swf instance?