4 Replies Latest reply on Sep 11, 2007 7:01 AM by kglad

    CS3 Runtime shared library linkage

    JamesAZaun
      I'm new to runtime shared libraries, so figured someone will see what obvious thing I'm doing wrong.

      Given:

      1. Created a Assets.swf with one exported MovieClip symbol with a linkage name called "Symbol1". "Export for actionScript", "Export for runtime sharing", and "Export in first frame" are all checked. URL: "Assets.swf"

      2. Created a Movie.swf that imports "Symbol1" from Assets.swf (using the Open External Library dialog).

      3. Attached a Document class to Movie.swf that contains the attached Movie.as code below.

      Result: Two compiler errors:

      Movie.as,Line 9 1046: Type was not found or was not a compile-time contant: Symbol1
      Movie.as,Line 9 1180: Call to a possibly undefined method Symbol1.

      Movie.as code:
      ---------------------------------------------------------------------
        • 1. Re: CS3 Runtime shared library linkage
          JamesAZaun Level 1
          Tried another variation. Attached a "Symbol1" class to "Symbol1" in the Assets.fla library via the Property dialog, (see attached code). This resolves the two compiler errors but no instance of "Symbol1" ever appears when Movie.swf runs.

          I read somewhere that earlier versions of the Flash Player may run into a case where the importing SWF may try to render symbols from the exporting SWF before they are loaded. Since, Movie.swf is 359 bytes and Assets.swf is 342 bytes, I wonder if that might be happening to me or is there a something more fundamentally wrong with my approach?

          Very perplexed.
          • 2. Re: CS3 Runtime shared library linkage
            kglad Adobe Community Professional & MVP
            there is no linkage in as3. assign a class name to your shared asset, load the swf containing the shared asset using the loader class and use the "init" event of the loader's loadinfo property to trigger instantiation of your shared asset using the "new" constructor.
            • 3. Re: CS3 Runtime shared library linkage
              JamesAZaun Level 1
              I wonder why Adobe even enables the "export for runtime sharing" checkbox if it doesn't do anything for AS3? This definately lead me down the wrong rabbit hole trying to get that approach to work.

              Anyway, I made the suggested code changes to Movie.as (attached). Unchecked the "export for runtime sharing" box on Symbol1 in Assets.fla. Removed the Symbol1 import from Movie.fla. And, sure enough, the Symbol1 import now works. Thanks, kglad.

              So in summary, the two points that I missed were:

              Every exported symbol must have as associated class definition in a corresponding .as file. so that symbol can in imported using the AS3 "import" directive.
              Ignore the "Export for runtime sharing" mechanism entirely and use the Loader class instead.
              • 4. Re: CS3 Runtime shared library linkage
                kglad Adobe Community Professional & MVP
                you're welcome.