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

  • Home
  • SEARCH
  • 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 8278065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:52:47+00:00 2026-06-08T08:52:47+00:00

I have a full browser window AS3 Flash CS4 parent swf which loads a

  • 0

I have a full browser window AS3 Flash CS4 parent swf which loads a third-party child swf, smaller in height/width and positioned appropriately (i.e. centered). No matter what loading technique I try to use, I’m running into placement and orientation problems in the child swf which break the child.

In one example case, the child will load a secondary displayobject (presumably a movieclip), but attempts to attach it to the stage. If I allow it access to the stage via the SecurityDomain during loading, it orients it at 0,0 of the parent swf instead of 0,0 of the child swf (which is already position/centered appropriately).

In another, the child positioning during load is appropriate, but placement inside the child which seem to reference the stage for their X,Y positions is offset by the amount the child swf has been centered (i.e. if the loader of the child swf is centered such that it’s X is at 200, and an object inside the child swf is supposed to be at 100,50, it is actually at 300,50).

The common thread seems to be that the child swfs, whether or not allowed to access the stage, are using stage or player properties of the parent instead of those of their own within the loader.

How can I isolate the child swf such that it only uses it’s own sub-environment for positioning and orientation and not the parent’s?

I have tried the built-in Loader and UILoader, Greensock’s SWFLoader, Flex’s SWFLoader and even loading it via text in a TextField.

It seems like AIR’s HTMLLoader would work (since SWF objects inside the HTMLLoader apparently use their own stage object), but this app has be available in the browser.

Ideally, I’d still like to be able to communicate with the child, but at this point ensuring the child runs successfully is more important.

This seems like a common approach, yet running into blocking issues left and right make me think I’m approaching this in the wrong way.

My last resort is to replace the parent swf with a JS framework, but only if absolutely essential.

Suggestions for solutions at any part of this process would be appreciated.

  • 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-08T08:52:49+00:00Added an answer on June 8, 2026 at 8:52 am

    Hope there’s not an SO “rule” against answering my own question…

    As weltraumpirat mentioned in comments, there appears to be no way to restricted a loaded swf from accessing stage variables such as positioning/orientation (mouseX & mouseY). The best solution is to restrict access to the stage so that loaded swfs can not add to it. This is done by including a LoaderContext object with the Loader.load call which defines a separate ApplicationDomain.

    var url:URLRequest = new URLRequest(/*...SWF URL...*/); 
    var context:LoaderContext = new LoaderContext(false,new ApplicationDomain());
    var ldr:Loader = new Loader();
    ldr.load(url,context);
    

    This will maintain a separate root in the loaded swf.

    In cases where the Loader object has been positioned away from (0,0) in the parent/main swf, You may then need to coordinate with the loaded swf authors to wrap stage.mouseX & stage.mouseY with DisplayObject.globalToLocal to reflect the unknown offset (from within the loaded swf).

    var localMousePt:Point = this.globalToLocal(new Point(stage.mouseX,stage.mouseY));
    

    It sucks, but it makes sense from a security perspective. I’ve found that it’s just common practice for a Flash developer to not think of the context in which their SWF might be loaded and therefore think nothing wrong with using the stage (instead of the root). Best practice should be to always use the root for adding and position objects because you never know where that root might be placed in the display list and how many parents their might be between it and the stage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have piece of javascript code, which should process when the browser window is
My flash program isn't using the full browser window, even while in full-screen mode.
How can I full-screen browser window after loading the page? I have used code
I have a page with an image, and two options: Show image full browser
I have a SL 4.0 app running out of browser with full priviliges. How
So, I have a browser window that if you click on a specific button
I have a <div> which I want to display full screen, but I also
I have full weekly backups, daily differential backups and hourly transaction log backups. To
I really want to have full control of section headers by laying out in
In my live site I have php include() and require() that have full path

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.