删除弹出窗口

时间:2013-11-28 20:06:33

标签: android flex flash-builder popupwindow

我正在使用Flash Builder 4.6开发移动应用程序 我想知道,如何为我的删除按钮删除弹出窗口?

带警告标题,是和否选项..

这是我的删除按钮代码..

            protected function onDeleteButtonClicked(event:MouseEvent):void {
            NoteDatabase.deleteNote(data as Note);
            navigator.popView();  }

          <s:Button x="281" y="556" label="Delete" 
          click="onDeleteButtonClicked(event)"/>                    

2 个答案:

答案 0 :(得分:0)

您可以使用简单的警报是/否确认

代码:

<s:Button id="deleteButton"
          x="281" y="556" 
          label="Delete" 
          click="onDeleteButtonClicked(event)"
          />

这将触发您上面已指出的功能。您需要做的就是添加以下代码:

protected function onDeleteButtonClicked(event:MouseEvent):void {
    Alert.show("do you want to delete this?", "Confirm Delete", Alert.YES | Alert.NO, null, alertListener, null, Alert.NO);
}

protected function alertListener(eventObj:CloseEvent):void {
     // Check to see if the YES button was pressed.
     if (eventObj.detail==Alert.YES) {
        NoteDatabase.deleteNote(data as Note);
        navigator.popView();  
     }
}

答案 1 :(得分:0)

您可以在视图上定义SkinnablePopupContainer(显示/添加删除按钮的位置)。添加如下内容:

注意:这是一个弹出的内联创建

<fx:Declarations>
    <fx:Component className="MyAlert">
        <s:SkinnablePopUpContainer>
            <s:Panel title="My Alert Panel">
                <s:VGroup width="100%">
                    <s:Label text="Delete" />
                    <s:Label text="Are you sure you want to delete this record?" />
                    <s:HGroup>
                        <s:Button label="Yes" click="deleteHandler();"/>
                        <s:Button label="No" click="close();"/>
                    <s:HGroup>
                </s:VGroup>
            </s:Panel>
        </s:SkinnablePopUpContainer>
    </fx:Component>
</fx:Declarations>

在你的处理程序上,

public function onDeleteButtonClicked(event:MouseEvent) : void {
    new MyAlert()).open(this, false);
}

public function deleteHandler() : void {
    //delete
}