Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-22-2011, 05:10 AM   PM User | #1
Palladian1881
New to the CF scene

 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Palladian1881 is an unknown quantity at this point
Communication between flash files

I'm having trouble setting up communication between two flash files. In the first file I have:
Code:
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:
Code:
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!
Palladian1881 is offline   Reply With Quote
Reply

Bookmarks

Tags
communication, flash, localconnection

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:29 PM.


Advertisement
Log in to turn off these ads.