Does ASC 2.0 recognize [Frame] metadata tags (ex: for Preloader factoryClass)?
Asked Answered
P

1

6

I'm trying to use the new ASC2.0 compiler in the AIR SDK 3.7, but I seem to be running into a problem where it cannot detect my preloader class.

If I use the non-ASC2.0 compiler, it recognizes and compiles the Preloader class declared in the Frame metadata tag in my Main class, like so:

[Frame(factoryClass = "Preloader")]

But as soon as I compile it with ASC2.0, it disregards the Frame metadata and just tries to compile the Main class and assume that it HAS to be a subclass of Sprite / MovieClip (which it does not necessarily have to be when it is Preloaded with a Frame metadata tag), so it fails to compile.

If someone can confirm this that'd be great, been spinning my wheels on this for a while. Thanks!

Polk answered 20/4, 2013 at 16:52 Comment(2)
FYI to others wandering here, for a tutorial on using a preloader class in a pure AS3 project, see this excellent tutorialPastiche
It's worth noting though that tutorial was written "pre" ASC 2.0, so it may only still apply to the standard SDK.Polk
P
10

Apparently, it is no longer supported. There was a similar question asked here:

ASC2.0 and Frame metatag

The new solution seems to be this:

You have to manually add the compiler arguments for the -frame data.

However, to get this working, you have to setup your project a bit differently from the [Frame] metadata technique.

Before (when using the old [Frame] metadata technique), you had to specify your Main class as the Document class (which would then compile and redirect the main entry point to your designated Preloader class).

Now with ASC2.0, instead, you will set your Preloader class as the Document class.

Here's a few things you must setup:

  • Your Preloader class should extend Movieclip subclass.
    (This makes it possible for your Main content to embed on Frame #2)
  • Assign your "Preloader.as" class (or however you called it) as the Document class.
  • Put this Additional Compiler Argument:
    -frame=AnyFrameLabelYouWant,YourMainClass
  • Also, add the SWF version with this Additional Compiler Argument:
    -swf-version=18 (though I think 17 will work with ASC2.0 as well...)
  • Make sure you are using the ASC2.0 SDK compiler in your IDE!

NOTE: Now that I think about it, maybe it's possible to inject /** @mxmlc */ JavaDoc comments to give the instructions to the compiler, but I didn't try this yet. That may be a workaround for the lack of Metadata support in the ASC2.0 compiler. (edit: I tried this once and this feature only seems to work with the "Build" toolbar button in FlashDevelop, which only compiles the currently focused file)

Polk answered 20/4, 2013 at 17:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.