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 754579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:01:48+00:00 2026-05-14T15:01:48+00:00

EDIT: Due to the answer I change the code posted. I’ve added the Security.allowDomain(*)

  • 0

EDIT: Due to the answer I change the code posted. I’ve added the Security.allowDomain("*") line and that line throws me an error. So, how can that be made?

I want to run an Action Script 3.0 Application into a Flex Application. To do this I’ve done the following:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication windowComplete="loadSwfApplication()" xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <![CDATA[
            private function loadSwfApplication()
            {
                // The next line throws me an error.
                Security.allowDomain("*");

                var urlRequest:URLRequest = new URLRequest("path/to/the/application.swf");
                swfLoader.addEventListener(Event.COMPLETE, loadComplete);
                swfLoader.load(urlRequest);
            }

            private function loadComplete(completeEvent:Event)
            {
                var swfApplication:* = completeEvent.target.content;
                swfApplication.init();  // this is a Function that I made it in the Root class of swfApplication
            }
        ]]>
    </mx:Script>

    <mx:SWFLoader id="sfwLoader"/>

</mx:WindowedApplication>

The problem is that in the calling of swfApplication.init(); the AIR Player throws me an exception:

Security sandbox violation: caller file:///path/to/the/application.swf cannot access Stage owned by app:/SWFApplicationLoader.swf.

This is because somewhere in application.swf I use the stage like this:

if (root.stage != null)
    root.stage.addEventListener(Event.REMOVED, someFunction);
root.stage.stageFocusRect = false;

How can I load this swf application and USE the stage without any problems?

  • 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-05-14T15:01:48+00:00Added an answer on May 14, 2026 at 3:01 pm

    You can try to load your SWF temporarily into a ByteArray and then load it with your SWFLoader.

    Don’t forget to set allowCodeImport to true since your SWF has as code inside.

    Of course be sure that your loaded swf is secure enough for your application since it will have access at all your property.

    private function loadSwfApplication():void {
      // load the file with URLLoader into a bytearray
      var loader:URLLoader=new URLLoader();
    
      // binary format since it a SWF
      loader.dataFormat=URLLoaderDataFormat.BINARY;
      loader.addEventListener(Event.COMPLETE, onSWFLoaded);
    
      //load the file
      loader.load(new URLRequest("path/to/the/application.swf"));
    }
    private function onSWFLoaded(e:Event):void {
     // remove the event
     var loader:URLLoader=URLLoader(e.target);
     loader.removeEventListener(Event.COMPLETE, onSWFLoaded);
    
     // add an Application context and allow bytecode execution 
     var context:LoaderContext=new LoaderContext();
     context.allowCodeImport=true;
    
     // set the new context on SWFLoader
     sfwLoader.loaderContext = context;
    
     sfwLoader.addEventListener(Event.COMPLETE, loadComplete);
    
     // load the data from the bytearray
     sfwLoader.load(loader.data);
    }
    
    // your load complete function
    private function loadComplete(completeEvent:Event):void {
     var swfApplication:* = completeEvent.target.content;
     swfApplication.init();  // this is a Function that I made it in the Root 
                             // class of swfApplication
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

THIRD EDIT: I now believe that this problem is due to a SOAP version
EDIT: See my answer below--> I am wanting to have a view that when
Edit : Note that, as Daniel and latkin noted in an answer and a
EDIT : It turned out that this can only be done through an external
EDIT: SOLVED! answer below first code box When i try to connect with a
I'm using jqGrid with inlineNav so that users can edit/add/delete rows locally and then
EDIT: Due to random downvotes still coming in I guess I can clarify this
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
EDIT: I was an idiot. I simply had an image that was vertically long,
EDIT: iam using ajax to load text in my content that is why onload

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.