As3 Eval updated

I’ve grabbed some recent .abc binaries from the Mozilla Tamarin repository. The ESC project is moving along quite nicely apparently, as this version is able to compile a lot more constructs. For example, it has enough namespace support to let scripts access objects located in other packages (see the sample code on the “Eval UI” tab in the demo.)
I’ve tweaked the way those binaries get injected within the player, which fixes a few bugs (such as chunks of bytecode getting GC’d before they have a chance to run..woops.)

Anyway, give it a whirl. I’ve finally included the es4eval.swc file too. I’ve another little project that builds on this stuff that I’ll blog about soon.

Explore posts in the same categories: web, actionscript, eval

13 Comments on “As3 Eval updated”

  1. Noemata Says:

    Thanks for making the swc binary available! I was able to build the lib after peeking inside. I presume you’re excluding some of the actionscript files because they present build/runtime issues?

  2. Peter Halacsz Says:

    this is a very amazing tool. I’ll try to integrate to our flash app. User could extend the app by scripting.

    Security should be considered. Now the byte code is Loaded as a child of the main app so if I have a static function that destroys something in the app, a script will be able to call this.

    Could you please help me to think about the next solution: my app is running in a domain. I put some kernel code in a child domain. The kernel can use the app domain.

    Then I load the compiler as a separeted domain and load the compiled byte code as a child of this.

    I haven’t found nothing similar to this.


  3. nuigroup Says:

    Question: would it be possible to have a Flash SWF running in standalone to load a “” file and then compile it into a SWF in which the parent SWF loads?

    I’m looking to build an open source AS3 compiler in Flash and see if there is a better way for application deployment… mainly in development scenarios.

    The compiler would not need to debug much… just show an error if something is wrong with the data being compiled.

    Thanks for this awesome lib… keep up great work

  4. Andres Santos Says:

    Hi Hurlant, just to THANK YOU, for such a tremendous work, it fits perfectly in a project I am working on, I’m really happy… really man, thank you I should get you a beer ;)

    Greetings from Mexico!

  5. Marcos Says:

    simply awesome…
    are you thinking to modify some part of this lib???
    What are the limitations???
    Thank you to distribute this lib in a free license

  6. HarHid Says:

    Hi ,

    Iím trying to integrate to flex-eval-application using AS3Eval-Library.
    This application uses, etc…

    So, I found following two bugs in com/hurlant/eval/abc/

    1. In public static function parseTrait()

    (1) actual lines (bug lines)
    var kind = tag&0×04;
    var attrs = (tag>>4) & 0×04;

    (2) expected lines
    var kind = tag&0×0f;
    var attrs = (tag>>4) & 0×0f;

    2. In public static function parseMethodInfo()

    (1) actual lines (bug lines)
    optionals[i] = [b.readU32(), b.readByte()];

    (2) expected lines
    optionals[i] = { val : b.readU32(), kind : b.readByte() };


  7. Pleh Says:


    I just got the latest build from the tamarin repository and I still cant compile packages/namespaces. Is there something im missing?

    For example…

    package Test{
    public class A{
    public function A(){}
    new Test.A();

    … will not compile because of the package keyword. Does anyone know how to get the tamarin esc to compile packages or namespaces?

  8. David Says:

    Will be nice if As3 Eval will show mx_internal, private and protected members and accessors from loaded SWF file. Looks like only using byteArray we can get these properties, because describeType method cannot provide that information. Any suggetion how can I use it?

    var classInfo:XML = describeType(getDefinitionByName(”mx.core.Application”));

  9. Aemon Cannon Says:

    Hey Metal,

    I’m working on a dynamic lisp compiler, written in AS3, and making use of AS3Eval:

    I have some questions related to Loader#loadBytes and I’m hoping you could shoot me an email so we can discuss further (I couldn’t find your email).

    Thanks, and great work on AS3Eval.


  10. Dave Schoonover Says:

    Haven’t seen any updates on this fantastic project in a while… Any chance you’re interested in dropping it in a git repo or on Google code (or something) so that we can all collaborate? I’d be interested in contributing.

  11. Bryan Elliott Says:


    I have a question regarding reflection in AS3, and specifically, dynamic instantiation ne Factories.

    For example, i’d like to be able to call Factory.newInstance(’myClass’, arg1, arg2,…), and retrieve a new instance of a registered Class.

    What I have in place right now is a rather terrible switch, that just runs the constructor based on the arguments given.

    If eval() was available, I’d even be able to eval an arbitrary length constructor.

    What would be best practices would be to be able to grab the argument count of the Class constructor*, throw errors as appropriate, and write / evaluate a little bytecode to instantiate the Class.

    * Can we peek into precompiled bytecode?

  12. Bryan Elliott Says:

    Ok, I’ve pulled out the Loader method for executing arbitrary bytecode, and tested that I can build and load an SWF with the arbitrary code loaded in. I’ve got the basic bytecode I’ll need to generate a method that can instantiate a generic class using X arguments.

    My next task is to get arguments (Class, Array) in and a return value (Object) out. Any ideas?

  13. Justin Hammond Says:

    Just curious if there is any ETA or level of effort on interfaces/inheritance. Please e-mail response if you can. Thank you.