Hello all!

I want to use OpionBotton so that the user chooses one of two script execution options: 1. Uploading data to a file; 2. Download data from the file;
But I can not return the result after selecting one of the options.
Help me please.
This is my code:
function getDialog1(){
   var flag = null;
   var dialog_templte = Dialogs.createNewDialogTemplate(0,0,400,200,"Settings");
   dialog_templte.OptionGroup("Choose");
   dialog_templte.OptionButton(15,25,390,15,"Uploading data to a file","V");
   dialog_templte.OptionButton(15,40,390,15,"Download data from the file", "Z");
   dialog_templte.OKButton();
   var myDialog1 = Dialogs.createUserDialog(dialog_templte);
   Dialogs.show(myDialog1);
   this.getResult = function()
    {
      if(this.dialog.getPage(0).getDialogElement("V").isEnabled()){           
         flag = 0;
         Dialogs.MsgBox("Uploading: flag = 0");    // Did not appear
      }
      if(this.dialog.getPage(0).getDialogElement("Z").isEnabled()){           
         flag = 1;
         Dialogs.MsgBox("Downloading: flag = 1");  // Did not appear
      }
      Dialogs.MsgBox("Result: flag = " + flag);   // Did not appear
      return flag;
    }
   Dialogs.MsgBox("Result2: flag = " + flag);   // Appeared "Result2: flag = null"
   return flag;
}