Hi All,
Not a question here, but I wanted to share something that was fairly obscure in the help docs. If you are using LocalConnection to talk to an as2 swf from an as3 swf you have to do some things differently than you might expect. Knowing this can really help in trying to completely unload a loaded as2 swf. For instance, you could change the test function to help you the loaded as2 swf unload itself. If you don't successfully do this, things get messy quick (memory leak, sound won't stop etc..). Basic sample code below (hopefully this can help someone in the future). Kurt ______________________________ Sending swf code (AS3) var AVM_lc:LocalConnection = new LocalConnection(); // loader loads AVM1 movie var loader:Loader = new Loader(); loader.load(new URLRequest("http://www.yourdomain.com/ as2_receiving.swf")); addChild(loader); loader.addEventListener(MouseEvent.CLICK, testfunction); //just to initiate test.. function testfunction(event:MouseEvent):void { AVM_lc.send("_AVM2toAVM1", "receivingfunction"); //IT IS CRUCIAL to add the underscore!! (for more info read about superdomains). } AVM_lc.addEventListener(StatusEvent.STATUS,onConnStatus) function onConnStatus(event:StatusEvent):void { switch (event.level) { case "status": trace("LocalConnection.send() succeeded"); break; case "error": trace("LocalConnection.send() failed", event) break; } } ____________________________________ Receiving swf (AS2): var AVM_lc:LocalConnection = new LocalConnection(); AVM_lc.client = this; AVM_lc.allowDomain = function ( domain ) { trace("allow domain called!!") //You can specify that only specific domains are allowed. In this case I'm allowing ALL domains. //Note; in AS3 code you could just say AVM_lc.allowDomain(*); return true; } // stopAnimation event handler AVM_lc. receivingfunction = function() { trace("success"); } AVM_lc.connect("_AVM2toAVM1"); //Again - the underscore is crucial. _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders