Sr.*_*hie 1 air actionscript-3
我刚刚在我的应用程序中发现了一个错误,它看起来像一个Flash播放器错误,我想知道是否有人找到了解决方法或其他东西.
我的应用程序中有一些单选按钮组.如果我按住空格键的同时按下箭头键,它会结束触发
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.controls::LabelButton/drawIcon()
at fl.controls::LabelButton/draw()
at fl.controls::RadioButton/draw()
at fl.core::UIComponent/callLaterDispatcher()
Run Code Online (Sandbox Code Playgroud)
如果发现这个线程描述了我的相同情况.你认为这有什么办法吗?它真的是一个flash bug吗?
所以,我调查了这个问题,发现标准fl组件有错误.它不仅仅与RadioButton有关.如果您按住SpaceBar然后通过单击"TAB"按钮切换当前UI元素 - 您将收到类似的错误.
要解决它,你应该修复组件的源代码:在类中LabelButton
,方法keyUpHandler
替换代码
setMouseState(oldMouseState);
Run Code Online (Sandbox Code Playgroud)
同
if (oldMouseState!==null) {
setMouseState(oldMouseState);
}
Run Code Online (Sandbox Code Playgroud)
并添加覆盖:
override protected function focusOutHandler(event:FocusEvent):void {
if (oldMouseState) {
keyUpHandler(new KeyboardEvent(KeyboardEvent.KEY_UP, true, true, 0, Keyboard.SPACE));
}
super.focusOutHandler(event);
}
Run Code Online (Sandbox Code Playgroud)
如果你不知道,你怎么做:
只需复制Adobe Flash CS5 install folder\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\LabelButton.as
到具有相同包结构的另一个目录\fl\controls\LabelButton.as
那么你需要将这个重复的结构包含在项目中.
这不是很好的方法,但在这种情况下,它确实修复了这个错误.顺便说一句,我会把它发送给Adobe.