That does not fix it :(

I've tried querying the domain property of the connection from both ends, and it is indeed returned as "localhost" so I know the movies are playing in the same sandbox.


On 2007-05-03, at 1:50 PM, John Grden wrote:

try naming your connection string by leading it with an underscore:

_lc_reportSending

On 5/3/07, Stephen Downs <[EMAIL PROTECTED]> wrote:

I'm having a tough time getting a simple LocalConnection connection
working.

Scenario: Flash 8, AS 2, two separate Flash projectors.

Procedure:
1) Projector A starts LocalConnection.connect.
2) Projector A opens Projector B via fscommand.
3) Project B initializes, then starts LocalConnection.send using
connectionName from step A. No arguments are sent.
4) Nothing happens, no onStatus calls are triggered either on the
LocalConnection instance or at the System level. The method does not
get called. Both connect and send calls return true.

This is all occurring on the localhost sandbox, so I'm pretty sure I
don't have to deal with security shenanigans. The code is all
contained in static singleton classes, so the LocalConnection objects
are class properties.

I'm probably overlooking something, but my brain is frazzled from
fiddling with this for the last five hours. Thanks in advance for any
insights or suggestions.

Code snippets follow.


// ***** From projector A main class:

// Use alerts as a debug aid.
import mx.controls.Alert;
// ...
public var _reportReceiver_lc:LocalConnection;

// This gets called from a button -- the initial trigger to open up
Projector B.
public function showReport():Void {
                        var theTimer:com.plasticbrain.timer.Timer =
com.plasticbrain.timer.Timer.getInstance();
                        // Establish listener for report open event
                        _reportReceiver_lc = new LocalConnection();
                        // This function doesn't get triggered.
                        _reportReceiver_lc.allowDomain =
function():Boolean {
                                Alert.show("allowDomain", "Alert");
                                return true;
                        }
// This function doesn't get triggered either.
                        _reportReceiver_lc.allowInsecureDomain =
function():Boolean {
                                Alert.show("allowInsecureDomain",
"Alert");
                                return true;
                        }
// *** This is what I want to call from Projector
B connection,
but it fails!
_reportReceiver_lc.initReport = function ():Void {
                                Alert.show("***initReport", "Alert");
                        }
var connectionName:String = "lc_reportSending";
                        var sendRes:Boolean =
_reportReceiver_lc.connect(connectionName);
                        Alert.show("showReport: listen="+sendRes+",
con="+connectionName);
                        // Last, open Projector B
                        fscommand("exec", "Report.app");
}



// ***** From projector B main class:

import mx.controls.Alert;
// ...
public var _reportSender_lc:LocalConnection;

// This gets called during initialization of Projector B.
public function initReport():Void {
                // Create object to pass status to main Timer client.
                _reportSender_lc = new LocalConnection();
                // This function doesn't get triggered.
_reportSender_lc.onStatus = function (infoObject:Object) {
                        Alert.show("onStatus", "Alert");
                        switch (infoObject.level) {
                        case 'status' :
                                Alert.show("connected!", "Alert");
                                break;
                        case 'error' :
Alert.show("connection error!", "Alert");
                                break;
                        }
                };
                var connectionName:String = "lc_reportSending";
                var sendRes:Boolean =
_reportSender_lc.send(connectionName,
"initReport");
                Alert.show("initReport: send="+sendRes
+",domain="+_reportReceiver_lc.domain()+", con="+connectionName);
}
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




--
[  JPG  ]
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to