Skip navigation
Currently Being Moderated

FlexPaper - Cannot load remote SWF files into AIR application?

Mar 8, 2013 12:25 PM

Tags: #air #pdf #flex #swf #flex-4.6 #flexpaper

I'm trying to load a SWF into a simple app for test purposes. The SWF has been compiled using swftools-0.9.1 using the following command:

 

/usr/bin/pdf2swf 10993.PDF -o 10993.SWF -f -T 9

 

The SWF loads fine in a browser.

 

Using the following Flex code together with Flex SDK 4.6:

 

<?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"

                       xmlns:flexpaper="com.devaldi.controls.flexpaper.*"

                       creationComplete="onCreationComplete()">

    <fx:Script>

        <![CDATA[

            import flash.utils.setTimeout;

           

            private function onCreationComplete():void

            {

                swf.SwfFile = 'http://my/domain/10993.SWF';

            }

        ]]>

    </fx:Script>

    <flexpaper:FlexPaperViewer width="100%" height="100%" id="swf"/>

</s:WindowedApplication>

 

The crossdomain.xml file is:

 

<?xml version="1.0"?>

<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy>

  <allow-access-from domain="*"/>

</cross-domain-policy>

 

The end result is:

 

SecurityError: Error #3207: Application-sandbox content cannot access this feature.

 

Any idea why this is happening?

 
Replies
  • Currently Being Moderated
    Mar 8, 2013 4:15 PM   in reply to RandomReado

    AIR will load the SWF into a sandbox.  Crossdomain.xml doesn’t apply to AIR apps because they are running from a desktop, not a domain.  If the SWF does not need any same-domain connection to a server when running, you can download the SWF as a bytearray and use loadbytes to view it.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 8:37 AM   in reply to RandomReado

    I would expect the loaded SWF to still be sandboxed.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 2:21 PM   in reply to RandomReado

    I'm getting the same kind of error as well, but in my case I'm loading the swf file from within the AIR application's directory, not over the web. I kinda think that FlexPaper was never designed to work in Flex desktop or mobile apps, as I have tried to contact their support on this and they basically are non-existent. This is kinda a shame, because on Android this technology would be a good solution for loading pdf documents within the app, without having to open them in an external viewer.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 9:33 PM   in reply to Keith Lee

    Is FlexPaper outputting an old AS2 SWF?  Then it will also be loaded into a sandbox.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2013 12:26 PM   in reply to RandomReado

    The swftools are creating swf files that call:

     

    Security.allowDomain("*");

     

    This why the error. I am not sure if there is a workaround for this, since swftools has no way to turn this off that I am aware of.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points