Flash CS5.5 库 & Flash Builder 4.5 工作流程
由于 iOS 项目的动画复杂,我有点被迫使用 Flash CS5.5 IDE,但我尝试使用 Flash Builder 4.5.1 来编码库 movieClips。在大多数情况下,这是有效的;我正在库中制作 movieClips,给它们指定类名,然后在 FB 4.5 中进行编辑。我的理由是,对于 iOS 来说,无论如何,这一切都必须是一个大文件。我真的不想把所有东西都制作成swc并嵌入Flash Builder中,只是想制作movieClips并在FB中编辑它们的代码。
但是,假设我在 Flash IDE 中制作了一个球。在库中,我给它一个类名“Ball”,它扩展了 MovieClip。当我回到主类中的 Flash Builder 时,我使用
var _ball:Ball = new Ball(); 添加孩子(_ball) 代码
有效,球从库放置到舞台上,但是有“?” Ball 实例化旁边的提示表明找不到该类型或者不是编译时常量。我真的不想为 Ball 创建一个自定义类 - 尽管我很确定如果我这样做并导入了一个自定义 Ball 类,它会找到它和“?”会消失,但是没有办法强制 Flash Builder “查看”Flash IDE 库对象/类吗?
非常感谢!
Because of intricate animations for an iOS project, I'm kinda forced to use Flash CS5.5 IDE, but I'm trying to use Flash Builder 4.5.1 to code library movieClips. For the most part this is working; I'm making movieClips in the library, giving them class names I then edit in FB 4.5. My rationale is for iOS it all has to be one big ass file anyway. I don't really want to make everything a swc and embed in Flash Builder, just want to make movieClips and edit their code in FB.
But, say I have made a ball in the Flash IDE. In the Library I give it a class name of 'Ball' that extends MovieClip. When I go back to Flash Builder in my main class I use
var _ball:Ball = new Ball();
addChild (_ball)
The code works and the ball is placed from library onto stage, however there is the "?" next to the Ball instantiation suggesting the type cannot be found or is not a compile time constant. I don't really want to make a custom class for Ball - although I'm pretty sure if I did and imported a custom Ball class it would find it and the '?' would go away, but is there not a way to force Flash Builder 'see' the Flash IDE library objects/classes?
Many Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Flash Professional 中,AS 链接应与类名称匹配。您可以从库中右键单击“编辑类”,然后选择 Flash Builder 来编辑类。
测试 AS 链接以确保您的类包从 Flash Professional 正确引用到您的代码。
在 Flash Professional 中构建的视图将实例化并添加子视图。如果将“Ball”影片剪辑从库拖到画板,则在运行时“Ball”类将被实例化并添加到舞台。
如果符号不需要编程实现,则无需创建该类。
根据大小,元件的类定义没有什么魔力 - Flash Pro 会自动为您创建类。当编译器引用该类时,您不会知道它的名称或它是如何定义的。
可以对这个问题进行细化,以更好地了解您的目标或您遇到的具体问题。
如果您希望在 Flash Builder 中进行编码,则可以使用 Flash Pro 来设计和布局视图,并从 Flash Pro 导出 SWC。在 Flash Builder 中,使用 [Embed] 元标记来引用符号。
如果您希望在 Flash Pro 中编写代码,则在编辑代码时仍然可以使用 Flash Builder。
这 ”?”并不意味着有错误。这是一个警告。您可能会在默认包中到处看到它 - 像 int、string、Number、MovieClip 之类的东西可能会显示“?”左侧的行号,因为 Flash Pro 中的playerglobal.swc 需要在 Flash Builder 的 .actionScriptProperties 中进行更正。
Flash Pro 的编译器应该解析这些引用并构建您的 SWF;然而,如果没有代码完成,或者只是看到这么多“?”,在 Flash Builder 中进行编辑可能会很乏味。按行号。
我建议:
如果您看到“?”从默认包类中,通过替换playerglobal.swc来更新您的.actionScriptProperties:
如果您的元件没有 AS 链接,则无法使用 ActionScript 引用它,除非您可以确保通过基类进行访问(例如将对象调用为 MovieClip)。不建议这样做。
In Flash Professional, the AS Linkage should match the class name. You can right-click from the library and "Edit Class", then select Flash Builder to edit the class.
Test the AS Linkage to assure your class package is correctly referenced from Flash Professional to your code.
Views constructed in Flash Professional will instantiate and add children. If you drag your "Ball" movie clip from the library to the artboard, at runtime the "Ball" class will be instantiated and added to stage.
If the symbol requires no programmatic implementation, then there's no need to create the class.
As per size, there's no magic to the symbol's class definition - Flash Pro automatically creates the class for you. You won't know it's name or how it's been defined when the compiler references the class.
This question could be refined to better understand your objective, or specific issue you are experiencing.
If your desire is to code in Flash Builder, than use Flash Pro to design and layout your views, and export SWC from Flash Pro. In Flash Builder, use the [Embed] meta tag to reference the symbols.
If your desire is to code in Flash Pro, you can still use Flash Builder when editing code.
The "?" does not mean there is an error. It's a warning. You might see it all over the place from the default package - things like int, string, Number, MovieClip may show a "?" on the left by the line numbers because the playerglobal.swc from Flash Pro needs corrected in your Flash Builder's .actionScriptProperties.
Flash Pro's compiler should resolve those references and build your SWF; however, editing in Flash Builder may be tedious without code completion, or simply seeing so many "?" by line numbers.
I'd suggest:
If you see "?" from default package classes, update your .actionScriptProperties by replacing the playerglobal.swc:
<libraryPathEntry kind="3" linkType="1" path="${FLASHPRO_APPCONFIG}/ActionScript 3.0/FP10.2/playerglobal.swc" useDefaultLinkType="false"/>
If your symbol has no AS Linkage, you cannot reference it using ActionScript, unless you can assure access via a base class such as calling objects as MovieClip. This would not be recommended.
您在问题中描述的工作流程一直困扰着我。设置资产的链接文件对我来说似乎是一种耦合 - 最后这只是一堆资产 - 为什么我应该将它们与一些固定行为结合起来?按钮和切换按钮的资源也应该足够。将其与 Button 类结合起来,然后您需要复制一个资源并将其链接到 ToggleButton。有些人可能会认为应该只有一个具有可切换属性的按钮类。尽管如此,我想你们都明白了。这就是为什么我热衷于深入研究 Flex 4 和整个设计者-开发者合同以及使用组件和皮肤的非常解耦的方式。
有一种方法可以在 Flash 中使用此方法,而无需在 FLA 中设置任何链接。事实上,我使用编译后的 SWF 作为皮肤的资源库。我开发了一个组件模型,其灵感来自于 Gumbo 的早期发展和 OpenFlux 框架,并应用于Flash 中也有类似的原理。如果您对详细信息感兴趣,可以阅读 我的博客中关于FLit框架的介绍文章。 完整代码 + 示例可在 Google 代码中获取。
The workflow you're describing in your question has always bothered me. Setting a linkage file of an asset seems like to much of a coupling to me - at the end this is just a bunch of assets - why should I couple them with some fixed behavior? Assets for a button should also be sufficient and for a toggle button. Couple it with the Button-class and then you need to duplicate an asset and link it to the ToggleButton. Some may argue that there should only be one Button-class with toggable-property. Nevertheless, I think you all are getting the point. That's why I relly dig into Flex 4 and into the whole designer-developer contract and very decoupled way of using component and a skin.
There is a way to use this approach in Flash without setting any linkages in the FLA. In fact I'm using the compiled SWF as an assets library of skins. I've developed a component model inspired from the early inception of Gumbo and the OpenFlux framework and applied similar principles in Flash. If you're interested in the details you can read the introduction article in my blog about the FLit framework. The whole code + examples are available at Google Code.