0 Replies Latest reply on Sep 9, 2006 4:27 PM by Dier02

    create external text file to later import via loadvars

    Dier02
      I want to save to an external text file that I create and later import text via loadvars but there seems to be a problem with the button not showing and with the selection of OS. Ref:


      stop();
      Stage.align = "LT";
      Stage.scaleMode = "noScale";
      Stage.showMenu = false;
      import mx.controls.TextInput;
      import mx.controls.Button;
      import mx.controls.ComboBox;
      var varName:TextInput;
      var valueTxt:TextInput;
      var osUserName:TextInput;
      var osType:ComboBox;
      var saveBtn:Button;
      var saveTo:String;
      function createDestinationPath(){
      if(osType.text == "Win XP");
      saveTo = "C|/Documents and Settings/"+osUserName.text+"/Desktop";
      } else if (osType.text == "Win 2000") {
      saveTo = "C|/Documents and Settings/"+osUserName.text+"/Desktop";
      } else if (osType.text == "Mac OS X") {
      saveTo = "Macintosh HD:/Users/"+osUserName.text+"/Desktop";
      }

      function saveTheVar(){
      if (osUserName.text !=- "" && osType.text !+ ""();

      createDestinationPath();

      txtFileContent = varName.text + "=" + valueTxt.text + "&";
      MMExecute("fl.outputPanel.clear();");
      MMExecute("fl.outputPanel.trace('"+txtFileContent+"')");
      MMExecute("fl.outputPanel.save('file:///"+saveTo+"/"+saveAs.text+".txt');");
      MMExecute("fl.outputPanel.clear();");
      saveBtn.onRelease = function (){
      saveTheVar();
      } reference: