0 Replies Latest reply on Jul 7, 2011 3:23 PM by chobo2

    How can I load an as2 swf into flex as3 app?

    chobo2

      I am trying to load a third-party as2 swf file into my application, but I keep running into the following error

       

       

      TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::AVM1Movie@28f7299 to mx.core.IVisualElement.

      at CasinoLoader/onComplete()[C:\_Projects\Casino_Old\FlashWrapperWorkspace\CasinoV2Loader\sr c\CasinoLoader.mxml:42]

       

       

      Based on my research it is because of the incomptability between as2 and as3 files, but should I still be able to just load it, but not be able to interact with it?

       

      This is the code I am using. Thanks

       

       

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

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

         xmlns:s="library://ns.adobe.com/flex/spark"

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

         creationComplete="initApp()"

         >

       

      <fx:Declarations>

      <!-- Place non-visual elements (e.g., services, value objects) here -->

      </fx:Declarations>

       

      <fx:Script>

      <![CDATA[

      import flash.display.Loader;

      import flash.display.Sprite;

      import flash.events.Event;

       

      import mx.controls.Alert;

      import mx.controls.SWFLoader;

       

      import spark.modules.ModuleLoader;

       

      protected function initApp():void

      {

      var url:String = "http://somedomain.com:13000/servlet/com.goblinstudios.lollipop.servlet.CasinoGatewayProxy3 ?sessionid=C9233C60-C51C-4B07-BCF0-EF1A4BD4B588&gametype=64&affiliateid=1&currency=CHP&lan guage=eng&freePlay=0";

      Security.allowInsecureDomain("*");

      Security.allowDomain('*');

       

      var sprite:Sprite = new Sprite();

      var loader:Loader = new Loader();

      sprite.addChild(loader);

       

      loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);

      loader.load(new URLRequest(url));

      }

       

       

      private function onComplete(e:Event):void {

      addElement(e.target.loader.content);

      }

       

      ]]>

      </fx:Script>

      </s:Application>