1 Reply Latest reply on Dec 3, 2009 2:00 PM by davfranck@gmail.com

    Communication between swf




      I have a communication problem between to SWF. Here is my code, SwfA is the caller :


      Shared interface between the 2 Swf :


      public interface ItfA {
      // some code


      In the second Swf, SwfB, the document class :


      public class MainB extends MovieClip {

      private var a:Itfa;

      public function start(_a:ItfA) {
      = _a;
      // etc



      In the first Swf, SwfA:


      public A implements ItfA {

      var mLoader:Loader;


      public function startLoad()
      = new Loader();
      var mRequest:URLRequest = new URLRequest(“B.swf”);
      .contentLoaderInfo.addEventListener(Event.COMPLETE,  onCompleteHandler);
      .contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onprogressHandler);

      public function onCompleteHandler(loadEvent:Event)
      var mainB = mLoader.content;
      public function onprogressHandler(mProgress:ProgressEvent)
      var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;



      My problem :

      When I test in the fash environment (ctrl + enter), there is no problem, but in my browser it failes and says that A is not an ItfA (TypeError: Error #1034)


      Any idea ?





        • 1. Re: Communication between swf
          davfranck@gmail.com Level 1

          Note :

          After some more tests, i've got an error in this case too : if i'am waiting an A object in the second Swf and if the main Swf sends an A object !

          The error :

          TypeError: Error #1034: Type Coercion failed: cannot convert com.test::TyrusGame@6c81f71 to com.test.TyrusGame.


          It's strange because the message seems to mean that the classes are not the same, and they are, because they are from a common file. A and B uses as3 files in a common folder and this folder is added to the classpath of the two projects.