Apache flex Actionscript 3消息框?

Apache flex Actionscript 3消息框?,apache-flex,actionscript-3,modal-dialog,messagebox,Apache Flex,Actionscript 3,Modal Dialog,Messagebox,我需要显示一个带有yes no按钮的模式确认对话框,并获得用户在ActionScript 3中单击的结果 Alert.show("Do you realy want to delete", "My Title", 3,null, function alertClickHandler(event:CloseEvent):void { if (event.detail==Alert.YES) {

我需要显示一个带有yes no按钮的模式确认对话框,并获得用户在ActionScript 3中单击的结果

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
ok save diaglog在调用exit时不启动,应用程序只是退出

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );

Abdul Khaliq

这是警报框的示例:

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
                        if (event.detail==Alert.YES)
                        {
                                //do stuff if clicked yes       
                        }
       } );

以下是警报框的示例:

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
                        if (event.detail==Alert.YES)
                        {
                                //do stuff if clicked yes       
                        }
       } );

Actionscript中的调用有时是异步的

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
特别调用文件保存和所有

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
你真正应该做的是:

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save(true);     // does not popup when next line is present                        
                 exit();

              }
       } );
修改保存功能,如下所示:

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
public function save(exitAfterSave:boolean):void
{
    //do whatever you need to do to save the file
    if(exitAfterSave)
    exit();
}

Actionscript中的调用有时是异步的

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
特别调用文件保存和所有

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
你真正应该做的是:

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save(true);     // does not popup when next line is present                        
                 exit();

              }
       } );
修改保存功能,如下所示:

 Alert.show("Do you realy want to delete", "My Title", 3,null,
        function alertClickHandler(event:CloseEvent):void
        {
              if (event.detail==Alert.YES)
              {
                 canvas.save();     // does not popup when next line is present                        
                 exit();

              }
       } );
public function save(exitAfterSave:boolean):void
{
    //do whatever you need to do to save the file
    if(exitAfterSave)
    exit();
}

Adnan我编辑了包含您答案的问题,但当调用exit()时,显示对话框不显示。Adnan我编辑了包含您答案的问题,但当调用exit()时,显示对话框不显示。为什么使用exit()?我需要在图像保存后发送ext,这不应该是保存和退出功能的工作方式吗?对不起,但是你真的很难理解。那么,现在有什么问题?是否要退出应用程序?我需要实现“保存退出”功能,但当我调用save方法、Filereference和所有内容时,不会出现“保存”对话框,而应用程序只会退出,当删除exit()函数时,保存功能会正常工作。为什么要使用exit()?我需要在图像保存后发送ext,这不应该是保存和退出功能的工作方式吗?对不起,但是你真的很难理解。那么,现在有什么问题?是否要退出应用程序?我需要实现“保存一个退出”功能,但当我调用save方法、Filereference和所有内容时,不会出现“保存”对话框,而应用程序只是退出,在删除exit()函数时,“保存”功能可以正常工作