Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8417785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:08:54+00:00 2026-06-10T02:08:54+00:00

I have an AIR App I’m working on and need to load a swf(always

  • 0

I have an AIR App I’m working on and need to load a swf(always from localhost) which will access some methods in it’s parent and vice versa. I’m not concerned with opening gaping security holes in a desktop app though. I’ve been searching all over but keep hitting walls with each implementation out there.

My current setup loads in the swf and it plays but I get a small error from the sandbox since I’m not in the same one as the app. Does anyone know how to get past this error so there is complete freedom opened up between the AIR app and the swf?

* Security Sandbox Violation *

SecurityDomain ‘http://localhost/test.swf’ tried to access incompatible context ‘app:/Test_Player.swf’

public function loadSWF():void {

//var context:LoaderContext = new LoaderContext();
//context.checkPolicyFile = true;
//context.applicationDomain = ApplicationDomain.currentDomain;
//context.securityDomain = SecurityDomain.currentDomain;

var req:URLRequest = new URLRequest(swfURL);
adLoader = new Loader();

videoCanvas.rawChildren.addChild(adLoader);

loader.contentLoaderInfo.addEventListener(Event.INIT, adLoadedHandler, false, 0, true);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError, false, 0, true);

//loader.load(req, context);
loader.load(req);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:08:55+00:00Added an answer on June 10, 2026 at 2:08 am

    You need to load your distant SWF with an UrlLoader and then reload it through loadByte. With this method you will by pass security.

    package
    {
        import flash.display.Loader;
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.net.URLLoader;
        import flash.net.URLLoaderDataFormat;
        import flash.net.URLRequest;
        import flash.system.ApplicationDomain;
        import flash.system.LoaderContext;
    
        public class TestDistantSwf extends Sprite
        {
            private var _urlLoader : URLLoader = new URLLoader;
            private var _loader : Loader = new Loader;
    
            public function TestDistantSwf()
            {
    
                addChild(_loader);
                // Won't work
                //_loader.load(new URLRequest("http://localhost/test.swf"));
    
                // Load it as binary
                _urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
                _urlLoader.addEventListener(Event.COMPLETE, onLoad);
                _urlLoader.load(new URLRequest("http://localhost/test.swf"));
            }
    
            private function onLoad(e : Event) : void
            {
                // Load distant swf data locally
                _loader.loadBytes(_urlLoader.data, new LoaderContext(false, ApplicationDomain.currentDomain));
            }
        }
    }
    

    If you need to pass arguments like flash var, two way to do it, if use Air 2.6 or later, you can use LoaderContext.parameters :

    private function onLoad(e : Event) : void
    {
        var lc : LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
        lc.parameters ={
            foo:"hello !"
        };
        lc.allowCodeImport = true;
    
        // Load distant swf data locally
        _loader.loadBytes(_urlLoader.data, lc);
    }
    

    And then get it with loaderInfo.parameters in your loaded SWF.

    Or you can call a function of loaded Swf :

    private function onLoadBinary(e : Event) : void
    {
        e.target.content.init("hello 2 !");
    }
    
    private function onLoad(e : Event) : void
    {
        var lc : LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
        lc.allowCodeImport = true;
    
        // Load distant swf data locally
        _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadBinary);
        _loader.loadBytes(_urlLoader.data, lc);
    }
    

    This will call from loaded swf in its main class:

    public function init(foo : String) : void
    {
        trace(foo);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working currently on an Air app for iOS and i have some hard
I have desktop AIR app which has been signed with a valid certificate from
i have an xml i load within my air app which looks like this:
I have an AIR app that I need to define a proxy for because
I have an air app created from one of Adobe's Examples using javascript /
working with Flex4 AIR app, using this component I get data from the barcode
I'm trying to build an Adobe Air app which runs from a PHP file.
I'm building an Adobe Air app that needs to load external images from different
I'm trying to load an swf file using SWFLoader in Adobe AIR app. The
I have an HTML/JavaScript Adobe AIR app which needs to be listening for data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.