1 Reply Latest reply on Sep 24, 2012 11:15 AM by 2ShoesLoose

    unable to load PanoPlayer VR swf in Air

    2ShoesLoose Level 1

      attempting to load a VR swf made by PanoPlayer into an AIR app results in:

       

      SecurityError: Error #3226: Cannot import a SWF file when LoaderContext.allowCodeImport is false.

                at flash.display::Loader/_loadBytes()

                at flash.display::Loader/loadBytes()

                at PanoPlayer/initPanoViewer()

       

      Note: the following code works fine in a Flex app for the web ...

       

      Code:

       

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

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

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

                                                           xmlns:mx="library://ns.adobe.com/flex/mx"

                                                           creationComplete="windowedapplication1_creationCompleteHandler(event)">


        <fx:Script>

                          <![CDATA[

                                    import mx.events.FlexEvent;

                                    import mx.core.UIComponent;

       

                                    protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void

                                    {

                                              var urlLoad:URLLoader = new URLLoader(new URLRequest("VR.swf"));

                                              urlLoad.addEventListener(Event.COMPLETE, loadComplete);

                                              urlLoad.dataFormat = URLLoaderDataFormat.BINARY;

                                    }

       

                     protected function loadComplete(event:Event):void

                                    {

                                              var loadContext:LoaderContext = new LoaderContext();

                                              loadContext.allowCodeImport = true;

                         theSWF.loaderContext = loadContext;

                                              theSWF.source = event.currentTarget.data;

                      }

       

                          ]]>

        </fx:Script>

       

                <s:SWFLoader id="theSWF" x="100" y="50"/>

       

      </s:WindowedApplication>