1 Reply Latest reply on Dec 18, 2006 1:13 PM by __Voodoo__Child__

    how can i store a variable to a file?

    phi2265 Level 1
      for some reason i can't find much on writing to files, is this not possible?

      and if it isnt possible, how can i keep a variable? i don't want the variable to reset to 0 every time someone loads a new instance of the page.

      also, for some reason.. it seems to me that if statements dont work as they should. the vote() function always executes the countVote() function even if choice doesn't = ans.
      anyone know what im doing wrong

      example..
      private function vote(choice):void {
      text1.text=choice
      if (choice=ans){
      countVote();
      }
      }

      private function countVote():void {
      total=total+1
      totalS=total.toString();
      text2.text=totalS
      }
      text2 displays the total count and every time i submit the vote, the count goes up no matter what i choose


      i also get a warning for all of the variables saying
      "1084: var 'total' will be scoped to the default namespace: sv1: internal. It will not be visible outside of this package." (sv1 is the name of the project)
      how to i make it visible outside of the package?
        • 1. how can i store a variable to a file?
          __Voodoo__Child__ Level 1
          In this case, the if statement will not work as you intended. You need to use the double-equals, ie, if (choice == ans)

          Also, the flash player is inside a sandbox for security reasons. Consequently, you can not write directly to files. To get around this, make a call to a php, python, java or .net script residing on the webserver that will write to a file for you. You can do this using the HTTPService object.