Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 847
chamberlainpi Avatar asked Apr 20 '13 16:04

chamberlainpi


1 Answers

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)

like image 56
chamberlainpi Avatar answered Nov 06 '22 07:11

chamberlainpi