Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

+ Reply to Thread
Results 1 to 9 of 9
  1. #1

    Default Communication between Flash Files

    I'm having trouble setting up communication between two flash files. In the first file I have:
    import flash.events.MouseEvent;
    stop();
    var mySender:LocalConnection = new LocalConnection();
    PlayBtn.addEventListener(MouseEvent.CLICK,clickPla y);
    StopBtn.addEventListener(MouseEvent.CLICK,clickSto p);
    function clickPlay(Event:MouseEvent){
    mySender.send("myConnections", "myAction", 2);
    }
    function clickStop(Event:MouseEvent){
    mySender.send("myConnections", "myAction", 1);
    }
    And in the second file:
    stop();
    var myReceiver:LocalConnection = new LocalConnection();
    myReceiver.connect("myConnections");
    function myAction(i:int){
    if (i == 1) {
    DisplayText.text = "STOP!"; //stop();
    } else if (i == 2) {
    DisplayText.text = "PLAY!"; //play();
    }
    }
    When the Play button is pressed, the second file should display "PLAY!", and likewise with the Stop button. Both files load just fine into a third flash file, but when I try to press either the play or stop buttons, it gives me this:
    Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.LocalConnection was unable to invoke callback myAction. error=ReferenceError: Error #1069: Property myAction not found on flash.net.LocalConnection and there is no default value.
    Why won't it recognize my "myAction" function?
    I'm using ActionScript 3 and CS5.
    Thanks!

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    485

    Default

    Ok... Nvm, again.. lol
    That must be a fluke error. You sure there isn't anything else wrong with your code?
    Last edited by Vlykarye; 06-22-2011 at 04:19 AM.

  4. #3

    Default

    I don't think anything else is wrong, but I'm not really sure. I'm pretty new to flash :P

  5. #4
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    485

    Default

    I don't much communication, but I'll duplicate what you have and try to see what could be wrong.

  6. #5

    Default

    Thank you

  7. #6
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    485

    Default

    Question:
    Are you trying to get two swf players to communicate?

  8. #7
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    485

    Default

    Dang. That was tricky.
    Add this to your second code:
    myReceiver.client = this;

    Cheers.

  9. #8

    Default

    It worked! Thank you so much!

  10. #9
    Join Date
    Jun 2009
    Location
    Houston, Tx
    Posts
    485

    Default

    Haha, no problem. Don't you love how unhelpful the help docs are? I do.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial