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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:08:08+00:00 2026-05-15T17:08:08+00:00

Note: This is an Actionscript project, not a Flex project. I have class A

  • 0

Note: This is an Actionscript project, not a Flex project.

I have class A defined in an RSL (technically, it’s an art asset that I made in the Flash IDE and exported for actionscript. The entire .FLA was then exported as a SWC/SWF).

I my main project I have class B, which inherits from class A. The project compiles fine, with no errors.

However, when when the project runs and I try to create an instance of Class B, I get a verify error. Creating an instance of Class A works just fine, however:

import com.foo.graphics.A;   // defined in art.swf / art.swc
import com.foo.graphics.B;   // defined locally, inherits from A
...
<load art.SWF at runtime>
...
var foo:A = new A(); // works fine
var bar:B = new B(); // ERROR!
// VerifyError: Error #1014: Class com.foo.graphics::A could not be found.

For reference, here is how I’m loading the RSL:

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onArtLoaded);
var request:URLRequest = new URLRequest("art.swf");
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
loader.load(request, context);

Class B is defined as follows:

import com.foo.graphics.A;
class B extends A {}
  • 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-15T17:08:09+00:00Added an answer on May 15, 2026 at 5:08 pm

    I don’t think this is a bug. It’s more a linkage problem.

    The verifier error doesn’t happen when you try to create an instance of B. It happens as soon as your main swf is loaded and verified by the player. This is an important distinction. To see what I mean, change this code:

    var bar:B = new B(); 
    

    to

    var bar:B;
    

    You’ll still get the error.

    I don’t know how you are builing the swf, but from the error it seems evident that the A class (B‘s parent) is being excluded from the swf. I can reproduce this using this mxmlc switch:

    -compiler.external-library-path "lib.swc"
    

    However, changing it to:

    -compiler.library-path "lib.swc"
    

    The problem goes. Obviously, this kind of defeats the purpose of loading the assets at runtime, since these assets are already compiled into your main.swf (in fact, it’s worse, because by doing that you’ve just increased the global download size of your app).

    So, if you set your art lib as external, the compiler can do type checking, you’ll get auto-complete in your IDE, etc. Your B class still depends on A being defined, though. So, at runtime, A has to be defined whenever B is first referenced in your code. Otherwise, the verifier will find an inconsitency and blow up.

    In the Flash IDE, when you link a symbol, there’s a “export in first frame” option. This is how your code is exported by default, but it also means it’s possible to defer when the definition of a class is first referenced by the player. Flex uses this for preloading. It only loads a tiny bit of the swf, enough to show a preloader animation while the rest of the code (which is not “exported in first frame”) and assets are loaded. Doing this by hand seems a bit cumbersome, to say the least.

    In theory, using RSL should help here if I recall correctly how RSL works (the idea being the a RSL should be loaded by the player transparently). In my experience, RSL is a royal pain and not worth the hassle (just to name a few annoying “features”: you have to hard-code urls, it’s rather hard to invalidate caches when necessary, etc. Maybe some of the RSL problems have gone and the thing works reasonably now, but I can tell you I’ve been working with Flash since Flash 6 and over the years, from time to time I’d entertain the idea of using RSL (because the idea itself makes a lot of sense, implementation aside), only to abandon it after finding one problem after the other.

    An option to avoid this problem (without using RSL at all) could be having a shell.swf that loads the art.swf and once it’s loaded, loads your current code. Since by the time your code.swf is loaded, art.swf has been already loaded, the verifier will find com.foo.graphics.A (in art.swf) when it checks com.foo.graphics.B (in code.swf).

        public function Shell()
        {
            loadSwf("art.swf",onArtLoaded);
        }
    
        private function loadSwf(swf:String,handler:Function):void {
            var loader:Loader = new Loader();
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handler);
            var request:URLRequest = new URLRequest(swf);
            var context:LoaderContext = new LoaderContext();
            context.applicationDomain = ApplicationDomain.currentDomain;
            loader.load(request, context);              
        }
    
        private function onArtLoaded(e:Event):void {
            loadSwf("code.swf",onCodeLoaded);
        }   
    
        private function onCodeLoaded(e:Event):void {
            var li:LoaderInfo = e.target as LoaderInfo;
            addChild(li.content);
    
        }
    

    In your current main class, add this code:

            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
    

    Move your constructor logic (if any) to the init method, and it should work fine.

    But what I don’t like about this approach is that you have to create another project for the shell.

    What I do, generally, is have a class that proxies the graphic asset.

        private var _symbol:MovieClip;
    
        public function B() {
            var symbolDef:Class = ApplicationDomain.currentDomain.getDefinition("com.foo.graphics.A") as Class;
            _symbol= new symbolDef();
            addChild(_symbol);
        }
    

    Since com.foo.graphics.A is just a graphical asset, you don’t really need to proxy other stuff. What I mean is, if you want to change x, y, width, etc, etc, you can just change these values in the proxy and the result is in practice the same. If in some case that’s not true, you can add a getter / setter that actually acts upon the proxied object (com.foo.graphics.A).

    You could abstract this into a base class:

    public class MovieClipProxy extends MovieClip {
    
        private var _symbol:MovieClip;
    
        public function MovieClipProxy(linkagetName:String) {
            var symbolDef:Class = ApplicationDomain.currentDomain.getDefinition(linkagetName) as Class;
            _symbol = new symbolDef();          
            addChild(_symbol);
        }
    
        //  You don't actually need these two setters, but just to give you the idea...
        public function set x(v:Number):void {
            _symbol.x = v;
        }
    
        public function get x():Number {
            return _symbol.x;
        }
    }
    
    public class B extends MovieClipProxy {
    
        public function B() {
            super("com.foo.graphics.A");
        }
    
    
    }    
    

    Also, injecting the app domain as a dependency (and moving the instantiation mechanism to other utility class) could be useful for some projects, but the above code is fine in most situations.

    Now, the only problem with this approach is that the linkage name in the constructor of B is not checked by the compiler, but since it’s only in one place, I think it’s manageable. And, of course, you should make sure your assets library is loaded before you try to instantiate a class that depends on it or it will trhow an expection. But other than that, this has worked fairly well for me.

    PS

    I’ve just realized that in your current scenario this could actually be a simpler solution:

    public class B extends MovieClip {
    
        private var _symbol:MovieClip;
    
        public function B() {
            _symbol = new A();
            addChild(_symbol);
        }
    
    }
    

    Or just:

    public class B extends MovieClip {
    
        public function B() {
            addChild(new A());
        }
    
    }
    

    The same proxy idea, but you don’t need to worry about instantiating the object from a string using the application domain.

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

Sidebar

Related Questions

NOTE: This is a followup to my question here. I have a program that
Project : Game in Flex builder 4 (Actionscript Project) Language : Actionscript 3 This
I've made a page entirely in flash (flex actionscript project), and for weird reasons,
(Note: This is not a question about what is the best way with code
Note: This question has broadened in scope from previous revisions. I have tried to
Note: This issue appears to be limited to SQL Server 2005 SP2 I have
Note: this is not real information: $ ssh-keygen -t rsa -C "tekkub@gmail.com" Generating public/private
Note: This problem occurs only on Mac, on Windows works fine. I have a
NOTE: This question is only loosely related to tinyxml, however including details like that
NOTE: This is an entire rewrite of the previous question. I have a model.

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.