2 Replies Latest reply on Aug 19, 2010 10:46 AM by stef2010

    Problem with running simple Flex3 SWF inside a Flex4 app


      I am interested in understanding how to run a Flex-3 SWF inside a Flex-4 SWF.


      My Flex-4 host app looks like this:


          <?xml version="1.0" encoding="utf-8"?>

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"


             xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">


          <mx:SWFLoader source="SimpleFlex3App.swf" loadForCompatibility="true"/>





      And this is the Flex-3 app:


          <?xml version="1.0" encoding="utf-8"?>

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="400">





          private function onClick():void


          labelField.visible = true;






          <mx:Button label="Click Me" click="onClick();" horizontalCenter="0" verticalCenter="-20"/>

          <mx:Label text="Clicked" visible="false" id="labelField" horizontalCenter="0" verticalCenter="20"/>




      I get a null object reference where the SWFLoader tries to set up the bridge. I assume it does not get an instance for the IMarshalSystemManager implementation.


          IMarshalSystemManager(sm.getImplementation("mx.managers::IMarshalSystemManager")).addChil dBridge(_swfBridge, this);



      By using the SWFLoader and setting loadForCompatibility to true I was following the adobe  documentation:


      I must be missing out on something very simple as both, my host and hosted apps, basically don't do anything special.


      Further, is it possible to do the opposite and run a Flex-4 based SWF inside a Flex-3 one? In my opinion the adobe doc does not clearly say yes or no.