什么是“static void Main”? Flash 中的等效项?
我正在一个之前在 Flash CS3 中成功运行的项目上尝试 FDT 编辑器。
FDT 成功构建并运行它,但 SWF 为空白(白色)。 我在输出文件上尝试了一些查看器,但它实际上是空白的。
一个区别是,现在我的项目似乎不包含我的条目 .fla
文件。 我是 Flash/ActionScript 新手,想知道该 FLA 文件是否包含一些类似于其他语言中的 public static void Main
方法的魔法。
那么,如果我纯粹在 ActionScript 3 中构建应用程序(没有 .fla
文件),我该如何指定入口点、画布大小等?
当然,有可能我错误地设置了 FDT :)
编辑:新手警报!
事实证明,我通过 FDT 看到的白色舞台是因为我的 FLA 运行在不同的文件夹中,并且我无法加载任何资源,因此没有任何内容可以显示。 我还配置了 FDT,这样我就没有通过调试器看到错误。
这个问题有点白痴。 删除这样的问题正常吗?
对于具有扎实编程背景的其他人来说,我发现这是对显示模型的一个很好的概述:
http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_02.html#152593
I am trying the FDT editor on a project that previously ran successfully in Flash CS3.
FDT builds and runs it successfully but the SWF is blank (white). I've tried a few viewers on the output file and it is actually blank.
One difference is that now my project doesn't seem to include my entry .fla
file. I'm new to Flash/ActionScript and am wondering whether that FLA file included some magic akin to a public static void Main
method in other languages.
So, if I'm building an application purely in ActionScript 3 (no .fla
files) how do I specify the entrypoint, canvas size, etcetera?
Of course, it's possible that I have set up FDT incorrectly :)
EDIT: Newbie alert!
Turns out that the white stage I was seeing via FDT was because my FLA was running in a different folder and I couldn't load any of my resources, so nothing was ready to display. I also had FDT configured in such a way that I wasn't seeing the error via the debugger.
This question is a bit dumb. Is it normal to delete questions like this?
For anyone else coming at Flash/ActionScript from a solid programming background, I found this to be a pretty good overview of the display model:
http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_02.html#152593
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
等效的就是主类的构造函数。 这是您指定进行编译的类(原则上,只有在正在编译的代码中引用其余类,无论是主类还是由它引用的任何类),才会编译其余类。
在 Flash IDE 中,它将是 Document 类的构造函数(如果您碰巧使用它,则不是强制性的)或只是主时间轴中的第一个关键帧。
The equivalent would be the constructor of the main class. That's the class that you specify for compiling (in principle, the rest of the classes are compiled only if they are referenced in code being compiled, be it the main class or any class reference by it).
In the Flash IDE, it would be the constructor of the Document class (if you happen to use one, it's not mandatory) or just the first keyframe in the main timeline.
您只能从 Flash IDE 发布基于 fla 的内容,因此如果您不再使用它,您将需要发布图形的资源 swf 等。
我假设您正在使用 MXML 编译器? 如果是这样,请检查 adobe live 文档,了解如何设置舞台大小等。
You can ONLY publish fla based content from the Flash IDE, so if you're not going to use that anymore you'll need to publish an assets swf of your graphics, etc.
I presume you're using the MXML compiler? If so check adobe live docs on how to set the stage size etc.
那么您在什么情况下使用 FDT? 假设它在 Eclipse 中运行,您只需要在构建过程中为 mxmlc 编译器指定一些参数。 例如...
$ mxmlc Main.as -默认大小 100 200
其中“Main.as”是您的入口点 AS3 文件,“100”是宽度,“200”是高度。 MXMLC 默认输出 SWF 的名称与输入类的名称相同。 因此,在此示例中,它将发布为名为“Main.swf”的 SWF,但这也是可配置的。
以下是 mxmlc 命令行参数的一个很好的 Adobe 资源: Adobe MXMLC 文档
HTH
So in what context are you using FDT? Assuming this is running in Eclipse you would just need to specify some arguments to the mxmlc compiler as part of your build process. For example...
$ mxmlc Main.as -default-size 100 200
Where 'Main.as' is your entry point AS3 file, '100' is the width, '200' is the height. MXMLC defaults the output SWF to the same name as your input class. So in this example it would publish as SWF called 'Main.swf', but that is configurable as well.
Here is a good Adobe resource for the mxmlc command line arguments: Adobe MXMLC docs
HTH
您可以使用 SWF 元数据在主类中设置一些内容
例如 -
[SWF(宽度='455',高度='200',backgroundColor='#123456',frameRate='25')]
You can use the SWF metadata to set a few things in your main class
For example -
[SWF(width='455', height='200', backgroundColor='#123456', frameRate='25')]