jactionscript

About

jactionscript is a Java library that interfaces with the JavaSWF2 Flash parser/generator, and provides an object-model for ActionScript bytecode. Future versions will provide tools for performing some kinds of static-analysis on the bytecode.

jactionscript is released under an MIT-style licence.

Limitations

Features

Example

This example code tries to print out 'links' in the Flash Movie,

public class LinkExtractor {
        public static void main(String[] args) throws IOException {
                GetUrlStackListener l = new GetUrlStackListener();
                SimpleStackSimulator v = new SimpleStackSimulator(l);
                SWFActionExtract extract = new SWFActionExtract(v);
                TagParser parser = new TagParser(extract);
                SWFReader reader = new SWFReader(parser, args[0]);
                reader.readFile();
        }

        private static class GetUrlStackListener extends NullStackListener {
                public void visitGET_URL2(GetURL2Action action,
                                          Operand target, Operand url)
                {
                        if (url.knownValue()) {
                                System.out.println("GET_URL2: "+url.getValue());
                        } else {
                                System.out.println("GET_URL2: (unknown)");
                        }
                }
                public void visitGET_URL(GetURLAction action) {
                        System.out.println("GET_URL: "+action.getURL());
                }
        }
}

When run with the appropriate CLASSPATH, the example produces output like this,

$ java uk.co.badgersinfoil.jactionscript.example.LinkExtractor rah_container.swf
GET_URL2: nav/topnav.swf
GET_URL2: nav/bottomnav.swf
GET_URL: http://www.goodtechnology.com
GET_URL: /rah/text_only/index.jsp
GET_URL2: (unknown)
GET_URL2: (unknown)
GET_URL2: (unknown)

Documentation

See the jactionscript javadoc.

Download

2004-02-29 jactionscript-0.1.0.tar.gz 377 KiB

Contact

dave <at> badgers-in-foil.co.uk