Copy link to clipboard
Copied
Hi,
in my page i have a main swf, which should check the existence of a second swf - if its missing, the main swf should display a certain message to the user, otherwise it should work as planned.
i thought to achieve this by using LocalConnection - the main swf is set as the sending swf, and it should call a certain function on the other swf. i was thinking that if the second swf is missing, the local connection would fail - either throw an error or its STATUS event listener would receive an 'error' message.
if you think as i did - well think again. no error was thrown and the listener got a 'status' message, although there's nobody to handle the LocalConnection 'send' method.
what did i miss? or is there a better way to achieve my goal?
cheers,
eRez
use:
...
protected function onEnterFrame(event:Event):void
{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
...
var conn:LocalConnection = new LocalConnection();
conn.addEventListener(StatusEvent.STATUS,onLCStatus);
//conn.connect("toolbarCheck");
conn.send("toolbarCheck","checkForToolbar");
}
private function onLCStatus(event:StatusEvent):void
{
if (event.level == "error")
{
// display message
}
else
Copy link to clipboard
Copied
show your localconnetion code (only) including your statusevent listener.
Copy link to clipboard
Copied
there you go:
protected function onEnterFrame(event:Event):void
{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
...
var conn:LocalConnection = new LocalConnection();
conn.addEventListener(StatusEvent.STATUS,onLCStatus);
conn.connect("toolbarCheck");
conn.send("toolbarCheck","checkForToolbar");
}
private function onLCStatus(event:StatusEvent):void
{
if (event.level == "error")
{
// display message
}
else
{
// keep on going...
}
}
and as i mentioned - at this point, there isn't any other swf which handles this call
Copy link to clipboard
Copied
use:
protected function onEnterFrame(event:Event):void
{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
...
var conn:LocalConnection = new LocalConnection();
conn.addEventListener(StatusEvent.STATUS,onLCStatus);
//conn.connect("toolbarCheck");
conn.send("toolbarCheck","checkForToolbar");
}
private function onLCStatus(event:StatusEvent):void
{
if (event.level == "error")
{
// display message
}
else
{
// keep on going...
}
}