如何抑制 Flash 迁移警告 (1090)

发布于 2024-08-27 04:11:00 字数 1512 浏览 7 评论 0原文

在 Flash Professional CS4 中,当我使用鼠标/键盘输入处理程序名称(例如 onMouseDown、onKeyUp 等)时,我会收到“迁移问题”警告,即使我已为它们添加了事件侦听器。这些名称对于函数来说是完全合法的,但由于这些名称在 ActionScript 2.0 中自动触发,我们现在(尽管是明智的)警告它们在 AS3 中不再自动使用。

我理解警告的目的,但它们对我没有用。我想抑制这些警告,但抑制任何其他警告,我通常确实发现这些警告很有用。

例如,当我使用这样的代码时:

/** @constructor */
public function MyClass() {
  addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
}

protected function onMouseDown(e:MouseEvent):void {

我收到如下恼人的警告:

警告:1090:迁移问题:在 ActionScript 3.0 中,Flash Player 在运行时不会自动触发 onMouseDown 事件处理程序。您必须首先使用 addEventListener ('mouseDown',callback_handler) 为该事件注册此处理程序。

Flex 编译器 (mxmlc) 标志(和 Flash Pro 设置)可以抑制动作脚本警告,或者 /em> 警告,但我不想要这样。这太笼统了。

理想情况下,我可以抑制特定的错误/警告编号(警告#1090)。

编辑:我发现了更多带有mxmlc -help advance的“高级”编译器标志,看起来很有希望。具体来说,以下似乎是可能的候选人:
警告已弃用的事件处理程序错误
警告弃用函数错误
warn-deprecated-property-error

如何让 Flash 使用这些?

编辑2:我在Flash User Data目录中找到了一个flex-info.xml样式的文档。
[用户数据文件夹]/Adobe/Flash CS4/en/Configuration/ActionScript 3.0/FlexInfo.xml 然而,该文件包含一条令人失望的注释: ,即使重新启动 Flash 后似乎也没有响应我的指令。
这越来越令人难过了。

编辑 3:发现一个问题“错误、烦人的“迁移问题” Adobe 错误跟踪器上的“警告”。 Flex SDK 已得到修复,但没有提及 Flash...

In Flash Professional CS4, I get "migration issue" warnings when I use mouse/keyboard input handler names such as onMouseDown, onKeyUp, etc., even though I have added event listeners for them. These names are perfectly legal for functions, but since these were automatically fired in ActionScript 2.0, we are now (albeit sensibly) warned that their use is no longer automatic in AS3.

I understand the purpose of the warnings, but they aren't useful for me. I want to suppress these warnings, but without suppressing any other warnings, which I generally do find useful.

E.g., when I use code like this:

/** @constructor */
public function MyClass() {
  addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
}

protected function onMouseDown(e:MouseEvent):void {

I get an annoying warning like this:

Warning: 1090: Migration issue: The onMouseDown event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( 'mouseDown', callback_handler).

There are flex compiler (mxmlc) flags (and a Flash Pro setting) which can suppress actionscript warnings, or all warnings, but I don't want that. That's too general.

Ideally I could suppress a specific error/warning number (Warning #1090).

Edit: I've found more "advanced" compiler flags with mxmlc -help advanced, which look promising. Specifically, the following seem like likely candidates:
warn-deprecated-event-handler-error
warn-deprecated-function-error
warn-deprecated-property-error

How do I get Flash to use these?

Edit 2: I found a flex-info.xml style document in the Flash User Data dir.
[userdatafolder]/Adobe/Flash CS4/en/Configuration/ActionScript 3.0/FlexInfo.xml
However, this file contains a disappointing comment: <!-- Flash does not support most flex-config options. -->, and doesn't seem to respond to my directives even after restarting flash.
This is getting sad.

Edit 3: Found an issue "Erroneous, annoying "Migration issue" warnings" on Adobe bug tracker. A fix is confirmed for the Flex SDK, but no mention of Flash...

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

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

发布评论

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

评论(5

萌梦深 2024-09-03 04:11:00

如果您在 $Flash/$LOCALE/Configuration/Actionscript 3.0/EnabledWarnings.xml 中编辑 EnabledWarnings.xml,则可以,其中 $Flash 是 Applications/Program Files 文件夹中 Flash 的路径,$LOCALE 是你的语言。

例如

/Applications/Adobe Flash CS4/en/Configuration/ActionScript 3.0/EnabledWarnings.xml

您需要编辑第 29 行,将 enabled 属性设置为 false< /strong> 表示 ID 1090警告

<warning id="1090" enabled="false"  label="kWarning_DepricatedEventHandlerError">EventHandler was not added as a listener.</warning>

快速旁注:

“Flash Builder (CS4)”是一个令人困惑的术语。 Flex Builder 3之后,Flex Builder更名为Flash Builder,不再有Flash Builder CS4。常规的 Flash IDE 称为 Flash Professional/Flash Professional CS4,这是为了避免名称相似的产品之间发生混淆:Flash Catalyst、Flash Builder(原名 Flex Builder)、Flash Professional。显然它并不总是那么有效:)

You can if you edit EnabledWarnings.xml in $Flash/$LOCALE/Configuration/Actionscript 3.0/EnabledWarnings.xml, where $Flash is the path to Flash inside your Applications/Program Files folder and $LOCALE is your language.

e.g.

/Applications/Adobe Flash CS4/en/Configuration/ActionScript 3.0/EnabledWarnings.xml

You will need to edit line 29, setting the enabled attribute to false for warning with id 1090:

<warning id="1090" enabled="false"  label="kWarning_DepricatedEventHandlerError">EventHandler was not added as a listener.</warning>

Quick sidenote:

"Flash Builder (CS4)" is a confusing term. After Flex Builder 3, Flex Builder got renamed to Flash Builder, there is no Flash Builder CS4. The regular Flash IDE is known as Flash Professional/Flash Professional CS4, this was to avoid confusion between products with similar names: Flash Catalyst, Flash Builder(was Flex Builder), Flash Professional. Obviously it doesn't always work that great :)

冰雪之触 2024-09-03 04:11:00

将正在调用的函数的名称从 onMouseDown 更改为 handlerOnMouseDown 怎么样?它能解决问题吗?

您正在使用 Flex Builder 吗?
如果是这样,请转到项目 ->属性-> Flex 编译器。在那里您可以向编译器添加参数。

What about changing the name of the function being called from onMouseDown to handlerOnMouseDown. Would it solve the issue?

Are you using Flex Builder?
If so, go to Project -> Properties -> Flex Compiler. There you can add arguments to the compiler.

柠檬心 2024-09-03 04:11:00

你为什么要推翻它?它从一开始就不存在。该错误消息实际上告诉您一些有用的信息。不要压抑它。

如果您想创建一个名为 onMouseDown 的事件处理程序,请尝试类似的操作

private function onMouseDown(e:MouseEvent) : void {
  // statements
}

Why are you overriding that? It never existed in the first place. The error message is actually telling you something useful. Don't suppress it.

If you want to create an event handler called onMouseDown, try something like

private function onMouseDown(e:MouseEvent) : void {
  // statements
}
‖放下 2024-09-03 04:11:00

我同意上一篇文章的观点;该消息试图告诉您需要注册该事件处理程序。仅添加一个名为 onMouseDown() 的方法是不行的。 添加类似的内容。

addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);

您需要做的是在构造函数或父组件中

I agree with the previous post; the message is trying to tell you that you need to register that event handler. Just adding a method called onMouseDown() won't do it. What you need to do is to add something like

addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);

in either your constructor or maybe in the parent component.

请你别敷衍 2024-09-03 04:11:00

您可以使用 Flash Builder 的问题过滤功能过滤掉这些警告:

  • 打开问题视图
  • ,右键单击打开下拉菜单的小三角形,
  • 配置内容...
  • 选择左侧的 ,创建一个新的配置,根据您的意愿命名,
  • 在右侧调整其设置:
    • 范围:同一项目中的任何元素(或您想要的任何元素)
    • 说明:选择不包含并输入迁移问题(这将过滤掉带有以下内容的警告)描述中的迁移问题)
    • 至少选择 Flex 问题

您可以通过在左侧选择多个来组合预定义和自定义配置。

You can filter out these warnings using Flash Builder's problems filtering capability:

  • open problems view
  • on the right click on the small triangle that opens a drop-down menu
  • select Configure Contents...
  • on the left side, create a new configuration, name it as you wish
  • on the right side adjust its settings:
    • Scope: On any element in the same project (or anything you want)
    • Description: choose doesn't contain and type in Migration issue (this will filter out warnings with migration issue in the description)
    • choose at least Flex problems

You can combine predefined and custom configurations by selecting more then one on the left side.

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