ActionScript / Flash - UIComponrent setStyle 常量类?

发布于 2024-11-05 21:33:37 字数 114 浏览 1 评论 0原文

Flash UI 组件有许多不同的样式需要设置,这需要将字符串名称传递给 setter 方法。虽然这当然不具有挑战性,但使用常量类会很有帮助,但我找不到。

是否没有可用于所有可能的样式设置的常量类?

Flash UI Components have many different styles to set, which require passing a string name to the setter method. while this certainly is not challenging, the use of a constants class would be beneficial but i can't find one.

is there no constants class available with all of the possible style settings?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱给你人给你 2024-11-12 21:33:37

从表面上看,简单的答案是否定的,而且这是有道理的。看来 setter 和 getter 通过访问相关对象的(有时)唯一和非唯一属性(如关联数组值)来工作。就像这样:

myTextField["textFormat"] = new TextFormat(etc, etc);

因此,拥有一个常量列表就像拥有一个包含从 UIComponent 继承的所有对象的所有各种属性的巨大列表。这不仅会是一个巨大而混乱的列表,而且这样的东西的存在将与 Flash 团队开发这些东西时的理想背道而驰。 Flash团队采取“我们不想牵着你的手,为你做这一切”的立场来提倡自己发明东西的自由。例如,看一下 Moorehill API 的例子。 Adobe 并没有为 Flash 社区构建 3D 引擎,而是公开了人们自己动手的能力。因此,一般来说,对于这些类型的东西,您可以安全地判断它们是否存在,只需通过判断“这是否太方便了?”这个问题来判断。或者,如果有疑问,您可以随时查看 as3 文档。转到有问题的方法,在本例中为 setStyle,如果该方法的参数接受在常量中具有预设值的字符串,文档会告诉您。 :)

http://help.adobe .com/en_US/FlashPlatform/reference/actionscript/3/fl/core/UIComponent.html#setStyle()

From the looks of it the simple answer is no and it makes sense. It appears the setter and getter work by accessing the (sometimes) unique and non-unique properties of the object in question like an associative array value. Like so:

myTextField["textFormat"] = new TextFormat(etc, etc);

So having a list of constants would be like having a huge list of all the various properties on all objects inheriting from UIComponent. Not only would this be a huge cluttered list but the existence of such a thing would be contrary to the ideals of the flash team when developing these things. The flash team takes a stance of "we don't want to hold your hand and do it all for you" to promote the freedom to invent things yourself. Take a look at the molehill API's for example. Adobe did not build a 3D engine for the flash community, but rather exposed the ability for people to do it themselves. So generally with these types of things you can safely judge if they exist or not just by judging with the question "would this be too convenient?" Or, if in doubt, you can always check the as3 docs. Go to the method in question, in this case, setStyle, and if the params for this accept a string that has preset values in constants, the docs will tell you. :)

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/core/UIComponent.html#setStyle()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文