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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:25:35+00:00 2026-06-17T09:25:35+00:00

please help i am getting this error and could not solve with any of

  • 0

please help i am getting this error and could not solve with any of the other methods described in all previous posts with similar topic.

Actually here i am loading a swf myMap onto another swf.
The swf loading works fine, but when try to remove this from stage i get the above said error…

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at actions.classes::MapInteractionManager/unloadSWF()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()

Here’s my as3 code…

 var _swfLoader:Loader;
    var _swfContent:MovieClip;

    loadSWF("myMap.swf");  //loading the swf file here

    function loadSWF(path:String):void {
       var _req:URLRequest = new URLRequest();
       _req.url = path;

       _swfLoader = new Loader();
       setupListeners(_swfLoader.contentLoaderInfo);

       _swfLoader.load(_req);
    }

    function setupListeners(dispatcher:IEventDispatcher):void {
       dispatcher.addEventListener(Event.COMPLETE, addSWF);
       dispatcher.addEventListener(ProgressEvent.PROGRESS, preloadSWF);
    }

    function preloadSWF(event:ProgressEvent):void {
       var _perc:int = (event.bytesLoaded / event.bytesTotal) * 100;
       // swfPreloader.percentTF.text = _perc + "%";
    }

    function addSWF(event:Event):void {
       event.target.removeEventListener(Event.COMPLETE, addSWF);
       event.target.removeEventListener(ProgressEvent.PROGRESS, preloadSWF);

       _swfContent = event.target.content;
       _swfContent.addEventListener("close", unloadSWF);

       main.stage.addChild(_swfContent);
    }

    function unloadSWF(event:Event):void {
       _swfLoader.unloadAndStop();

    main.stage.removeChild(_swfContent);  //getting error when trying to remove swf
       _swfContent = null;
    }


    and close event is as,
    _swfContent.dispatchEvent(new Event("close"));

Please help, I’m stuck.

here with some update,
i updated code as,

function unloadSWF(event:Event):void
{
     if(main.stage.contains(_swfContent))
           main.stage.removeChild(_swfContent);
}

Now the error is gone as it is not entering the if loop!!!???

But still i can see that swf on stage:( plz help

GOT SOLVED…
Thanks everyone for helping…

ToddBFisher did solve it:)

Simply added the _swfLoader to the stage, loaded it, and attached the close listener to it instead of even having a _swfContent. Cut out the middle man and it worked…. Hope this helps…

  • 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-17T09:25:36+00:00Added an answer on June 17, 2026 at 9:25 am

    As I recall .unloadAndStop(); does a bunch of cleanup type things, which you are calling right before. It is possible part of the cleanup is removing it from the display list.

    Try calling the removeChild() before calling unlodaAndStop()

    function unloadSWF(event:Event):void {
        stage.removeChild(_swfContent);  //getting error when trying to remove swf
        _swfLoader.unloadAndStop();
        _swfContent = null;
    }
    

    EDIT

    Try simply adding the _swfLoader to the stage, load it, and attach the close listener to it instead of even having a _swfContent. Cut out the middle man and see what happens.

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

Sidebar

Related Questions

I'm getting this error. Please help! Parser Error Description: An error occurred during the
I can't figure out why I keep getting this error. Please help!!! 'System.Collections.Generic.List' does
Im getting angry with this error and cannot solve it. Please, some Jedi master
Im getting this error. Even though i already created a folder CMSExportedData Could not
No Idea why this is not working - could someone please help? update c
Please help me out on this explode() function issue. I am getting unexpected results
Please help I am getting the following error when I am binding the drop
I am new to Java+Maven and PlayN. Please help me regarding following error. Getting
Possible Duplicate: Im getting this error ‘autorelease’ is unavailable: not available in automatic reference
I'm not sure why am I getting this strange result. Can someone please shed

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.