4

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.

hood
  • 141
  • 5
  • I was doing something unrelated and discovered [SWFExplorer](http://www.bytearray.org/?p=175) which did the first step of decoding a SWF. Reading Adobe's SWF and ABCFile documentation and modifying SWFExplorer I was able to see the information! But there's currently no PHP library that I have found that will do this, so I'll have to port SWFExplorer to PHP myself... If I get around to doing that I'll answer properly with a link. :) – hood Nov 10 '11 at 04:04
  • Actually I couldn't see the actual information. I was seeing the constant SVN_VERSION from it is used in the main MXML file. Moving references to a AS file removes the actual string from the ABCfile, and the "172" string does not appear in any case. Looks like even more work is required to get those constants! – hood Mar 08 '12 at 00:41

1 Answers1

1

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"];
Marty
  • 39,033
  • 19
  • 93
  • 162
  • Thanks, but I'd like to get the SVN version of the SWF before sending anything to the client. And with minimal/no changes to the AS code for this purpose. – hood Oct 25 '11 at 05:35