AS3:没有输入的警报事件发射



我有一个警报,当用户单击删除按钮时会弹出。但是,当创建警报时,尽管没有用户输入,但它仍会触发Yes函数。

显然,使用删除按钮这是不好的。

        protected function handleDelete(event:Event): void {
            showAlert();
        }
        private function showAlert():void{
            Alert.yesLabel = "Delete";
            Alert.noLabel = "Cancel";
            Alert.show("Are you sure you want to delete this?", "Confirm Delete", Alert.YES|Alert.CANCEL, this, delete(), null, Alert.CANCEL);
        }

不确定为什么,但是当创建警报时,无论用户的输入如何

警报是flex默认警报,无覆盖或其他任何内容。

delete()应没有 (),因为您想传递对它的引用,不要调用它并传递返回值。

最新更新