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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:33:57+00:00 2026-05-12T16:33:57+00:00

Fundamental question here. Typically in AS3 you load in a SWF via the Loader,

  • 0

Fundamental question here. Typically in AS3 you load in a SWF via the Loader, and what you get is some sort of pseudo MovieClip that is of type “Loader”.

Is there any holy way under the sun to cast this loaded SWF to a custom type that extends MovieClip and not Loader, assuming the SWF was published with a base class of the custom type? Without data loss?

Alternatively, let’s say you can’t, can you even cast it from a custom type that extends Loader itself?

  • 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-12T16:33:57+00:00Added an answer on May 12, 2026 at 4:33 pm

    You can do something like this:

    Code in the stub swf:

    package {
    
        import flash.display.MovieClip;
    
        public class Stub extends MovieClip implements IStub {
    
            public function Stub() {
                trace("Stub::ctor");
            }
    
            public  function traceIt(value:String):void {
                trace("Stub::traceIt " + value);
            }
        }
    }
    

    I’m using an interface, but it’s not strictly neccesary.

    package {
    
        public interface IStub {
    
            function traceIt(value:String):void;
    
        }
    }
    

    Code in the “main” swf.

    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.INIT,handleInit);
    loader.load(new URLRequest("Stub.swf"));
    
    function handleInit(e:Event):void {
        var stub:Stub = loader.content as Stub;
    //  or, using an interface 
    //  var stub:IStub = loader.content as IStub;
        stub.traceIt("testing");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First question here: it is a very short yet fundamental thing in Java that
The fundamental question is how do I create a unit test that needs to
I was hoping if anyone can answer a fundamental question that I have regarding
I have a rather fundamental question about XML here. When declaring an element's xmlns
Okay, here is a very simple and fundamental question. If I have an application
This is a fundamental question, but an important one none the less... When starting
I come from Windows .Net forms development. This is a pretty basic/fundamental question. I'm
This question is fairly fundamental.I gave a simple and straighfoward test on my cygwin:
My question is very fundamental, I want to know straight forward and right way
I have some basic questions around understanding fundamentals of Performance testing. I know that

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.