5 Replies Latest reply on Mar 21, 2012 7:02 AM by kglad

    PLEASE HELP - I'm desparate

    Dazzer1977

      Hi all,

       

      There must be a real kind person out there on the WWW who could spare me 5 mins and rescue me before I top myself! I have a problem and Im sure it's really basic so please don't laugh. I have a movie clip on my stage with 8 buttons in it that all sequentially fade in via an alpha tween 0 to 100%. All the buttons simply link off to different URL's on click. What I want to do is when a button is clicked I want to store pressed along with the date and time it was pressed into a .csv file. I'd even be happy to make a contribution to someone's given charity if they could spare me the help! I'm at breaking point...

       

      Thanks

      Daz

        • 1. Re: PLEASE HELP - I'm desparate
          kglad Adobe Community Professional & MVP

          what kind of app?  web-based?  projector?  air?

          • 2. Re: PLEASE HELP - I'm desparate
            Dazzer1977 Level 1

            Sorry. I've create a small flash animation with 8 buttons

            • 3. Re: PLEASE HELP - I'm desparate
              kglad Adobe Community Professional & MVP

              will you be publishing an html and swf file to deploy on the internet?

              • 4. Re: PLEASE HELP - I'm desparate
                Dazzer1977 Level 1

                That's correct. We will be hosting the .swf and html on a web server which supports PHP, Zend Framework, Perl, Python, Ruby, SSI programming.

                 

                Basically I have a few buttons which Alpha  in sequentially (very basic I know) over 10 seconds stored in a movie clip on my stage which link off to different URL's. I have the button's linking perfectly using getURL (on click). What I want to do is track what button is pressed and when (date and time stamped) in a .CSV which I was hoping to store on the same web server. I have been reading I need to use .PHP in the HTML code so flash can talk to the .PHP which will then write to the .CSV file. Does that sound right? If so I don't have the foggist on how to do it? Any help would be most appreciated.

                 

                Thanks in advance for your help.

                • 5. Re: PLEASE HELP - I'm desparate
                  kglad Adobe Community Professional & MVP

                  you can use the LoadVars class to send your csv string to a php file that will then save your file on your server.  your actionscript will look like:

                   

                  var sendLV:LoadVars=new LoadVars();

                  var receiveLV:LoadVars=new LoadVars();

                  receiveLV.onData=function(src):Void{

                  trace(src):

                  // do something is save is success/fail

                  }

                  sendLV.csv="val1,val2,val3,...,valn";

                  sendLV.sendAndLoad("yourphpfile.php",receiveLV,"POST");

                   

                  and your php file:

                   

                  <?php

                  $yourfile = "yourcsvfilename.txt";

                  $fh = fopen($yourfile, 'a') or die("can't open file");   // assuming you want to append data use this, but check if there's already data and separate old and new data with a comma

                  $stringData = $_POST['csv'];

                  fwrite($fh, $stringData);

                  fclose($fh);

                  ?>

                  1 person found this helpful