[swx] storing swx file on server

Aral Balkan aral at aralbalkan.com
Tue Sep 25 10:10:31 PDT 2007


Or you can hit the SWX gateway via GET in the browser and you will get
the SWF file back as a download and you can use this for offline data,
etc. Not sure if that's your  use case here.

Take care,
Aral

On 9/25/07, Fabrício Seger Kolling <dulldusk at gmail.com> wrote:
>
>  You will have to modify SwfCompiler.php at line ~570.
>  function writeSwf($data, $debug = false, $compressionLevel = 4, $url = ''){
>      ...
>      header("Content-Type: application/swf;");
>      header('Content-Disposition: attachment; filename="data.swf"');
>      header('Content-Length: ' . strlen($swfFile));
>      echo $swfFile;
>  }
>  All you have to do is return $swfFile at writeSwf() call on swx.php and
> then store it in the database of filesystem.
>  To write out the contents again, just echo the stored data.. ah, and don't
> forget the headers.
>
>  Dulldusk
>
>
>  Andrew Sinning wrote:
>  Thanks Folkert.  I don't think I was quite clear enough in my question.  I
> know how to write out to a file or to a db from php, and I've studied the
> way that the swx.as library 'prepares' the data to be sent up to php.  I
> understand that when a Flash movie posts data to PHP SWX, the data is sent
> up as a JSON string.  I could then simply have a generic php script store
> the JSON string somewhere for future use, at which point I could send back
> the JSON string to Flash.  However, my understanding of the power of PHP SWX
> is that when you get data back from it, it is already in the form of a
> movieClip -- it doesn't need to be parsed.  If so, then what I would like to
> do is store the swx data in a file on the server and then return this data
> back to the Flash movie at some later date.  Could I just write out the
> contents as a 'swf' file?
>
>
>  Folkert Hielema wrote:
> In the last message on the list there is how you save a file with php.
>
>  Basicly what you do is write yourself a class with the methods you need.
> The class you can decide to connect to the db or to a text file.
>   A simple (not tested out of the head ;)) class would be something like
> this
>
>  class YourDataService
>  {
>        function YourDataService()
>        {
>            //here you connect to the db and select the db you want to use
>        }
>
>        function saveMessage($says, $user ="NONE")
>          {
>              //do data validation so your not supprised with attacks of any
> kind
>  //if data is not good return 'false' else insert it to the db
>              $result = mysql_query("INSERT INTO yourTable(id, user, message)
> VALUES ('','".$user."','".$says."')");
>
>              if($result)
>              {
>                  return true;
>              }else
>              {
>                  return false;
>              }
>          }
>  }
>
>  That is in shorts ;)
>
>  good luck,
>
>  Folkert
>
> On 9/25/07, Andrew Sinning <andrew at learningware.com> wrote:
> I learned about swx at our local Flash users' group last week.  I'm
>  really excited about using it.  I am quite sure that I don't fully
>  understand all of its power, as I've never used any of the tools that
>  it's being compared to.  I've always just used LoadVars and xml.
>
>  The example in the tutorial shows how to get data from a server to a
>  Flash movie using SWX PHP.  I would like to create the data in a Flash
>  movie, post it to the server, store it on the server, either as a raw
>  text file or in a db, and then later serve the swx back to a different
>  Flash movie.
>
>  How would I do this using SWX PHP?
>
>  Thanks!
>
>
>  _______________________________________________
>
>
> _______________________________________________
> swx mailing list
> swx at osflash.org
> http://osflash.org/mailman/listinfo/swx_osflash.org
>
>



More information about the swx mailing list