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

强颜欢笑 提交于 2019-12-12 11:04:15

问题


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!


回答1:


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)



来源:https://stackoverflow.com/questions/16122820/does-asc-2-0-recognize-frame-metadata-tags-ex-for-preloader-factoryclass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!