Read ActionScript 3 constants from SWF in PHP

550 Views Asked by At

Just wondering if there is a way to read class static constants from a SWF file server side. I have found things like getimagesize() but it doesn't have all these details. I guess that means I need a partial decompiler.

Specifically, I have this class in my Flex project:

package
{
    public class AppVersion
    {
        public static const SVN_VERSION:String = "172";
        public function AppVersion()
        {
        }
    }
}

SVN_VERSION is updated using an ant script on build. AppVersion.SVN_VERSION is displayed to the user using ActionScript code, so it should be available somewhere in the SWF.

I'd like to be able to read that version from PHP so it knows which version of the SWF it's dealing with. This same SWF is used in about 20 projects, of various revisions, so the PHP will do some things slightly differently depending. The PHP is running on either Mac OSX or Linux, if that makes a difference.

1

There are 1 best solutions below

1
On

You could send the value to PHP using the following classes:

  1. URLRequest
  2. URLLoader
  3. URLVariables

Would basically just be something like:

var variables:URLVariables = new URLVariables();
variables.svnVersion = SVN_VERSION;

var request:URLRequest = new URLRequest("http://your_domain.com/your_php_file.php");
request.method = URLRequestMethod.POST;
request.data = variables;

var loader:URLLoader = new URLLoader();
loader.load(request);

And from here you can access the value in PHP via:

$_POST["svnVersion"];