Hi,

Well using some of the 100's of hours I had into development of a
"different" compiler, out of the shear joy of reusing time I lived I have
the following compiling with FalconJX and the JXEmitter.

I have the builtin.swc and HTMLCoreLib.swc loaded in FalconJX when
compiling, no playerglobal.swc.

I also have full code completion in IntelliJ using no SDK just the
builtin.swc and HTMLCoreLib.swc.

Window.document and Window. automatically get boiled down into global in
the emitter, pretty neat, it just majically works on the JS side.

Not bad for a days work. :)

----------------------------------------------------------------------
Using this html;
----------------------------------------------------------------------

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="Greeter.js"></script>
</head>

<body>

<script type="text/javascript">
    Greeter.start();
</script>

</body>
</html>


*We get the screenshot of;*

http://snag.gy/Mtiln.jpg

----------------------------------------------------------------------
Greeter.as
----------------------------------------------------------------------

package
{
public class Greeter
{
    public var greeting:String;

    public function Greeter(greeting:String)
    {
        this.greeting = greeting;
    }

    public function greet():String
    {
        return "Hello, " + greeting;
    }

    public static function start():void
    {
        var greeter:Greeter = new Greeter("how are you FalconJX?");

        var button:Element = Window.document.createElement("button");
        button.textContent = "Say Hello";
        button.onclick = function ():void
        {
            Window.alert(greeter.greet());
        };
        Window.document.body.appendChild(button);
    }
}
}

*Cross compiled to Javascript;*

----------------------------------------------------------------------
Greeter.js
----------------------------------------------------------------------

function Greeter(greeting) {
    this.greeting = greeting;
}

Greeter.prototype.greet = function() {
    return "Hello, " + this.greeting;
};

Greeter.start = function() {
    var greeter = new Greeter("how are you FalconJX?");
    var button = document.createElement("button");
    button.textContent = "Say Hello!";
    button.onclick = function() {
        alert(greeter.greet());
    };
    document.body.appendChild(button);
};

Mike

Reply via email to