2 Replies Latest reply on Jul 5, 2011 8:58 AM by owencmcnamara

    Loading Flex-based SWFs in Flash Pro SWF?

    owencmcnamara

      Hello,

       

      I could really use some help in loading SWFs created in Flex (Flash Builder 4.5) into a SWF created in Flash (Flash Pro CS5). The only method I've been able to find that supposedly works is as follows:

       

      1. var loader:Loader = new Loader();
      2. addChild(loader);
      3. loader.load(new URLRequest("my-flex-app.swf"));
      4. loader.addEventListener("mx.managers.SystemManager.isBootstrapRoot", systemManagerHandler);
      5. loader.addEventListener("mx.managers.SystemManager.isStageRoot", systemManagerHandler);
      6. function systemManagerHandler(event:Event):void { event.preventDefault(); }

       

      Which I got from this website: http://troygilbert.com/2009/05/loading-flex-based-swfs-in-as3-only-swfs/

       

      This doesn't work for me. The output I get in Flash just says "file type is application/x-shockwave-flash" and the loaded SWF is black. I get none of the traces I put into the Flex SWF.

       

      Can anyone tell me a reliable method of loading Flex-created SWFs into Flash-created SWFs? Thanks for the help.

        • 1. Re: Loading Flex-based SWFs in Flash Pro SWF?
          Lee Burrows Level 4

          hi

           

          have you published your flex swf with RSLs merged into code (framwork linkage option in build path settings) - i dont think it will work without this

          1 person found this helpful
          • 2. Re: Loading Flex-based SWFs in Flash Pro SWF?
            owencmcnamara Level 1

            Thank you for the suggestion. I went into Flex > Project Properties > Flex Build Path > Library Path and set the Framework Linkage to "Runtime shared library (RSL)". I rebuilt the project and tested it, but it still does not load the Flex SWF inside the Flash SWF.

             

            I remember reading somewhere that "stop();" is needed on the first frame of all loaded SWFs. Does that apply to Flex SWFs? I wouldn't think so since Flex doesn't have a timeline.

             

            Edit:

             

            Never mind, I got it! My version of Flash Player in Flash Pro was an older version than in Flex. Thanks for the help!