• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

LocalConnection works when it should fail

Participant ,
Apr 15, 2012 Apr 15, 2012

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

TOPICS
ActionScript

Views

629

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 15, 2012 Apr 15, 2012

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

  

...

Votes

Translate

Translate
Community Expert ,
Apr 15, 2012 Apr 15, 2012

Copy link to clipboard

Copied

show your localconnetion code (only) including your statusevent listener.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 15, 2012 Apr 15, 2012

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 15, 2012 Apr 15, 2012

Copy link to clipboard

Copied

LATEST

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...

      }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines