The book of inspiration

September 4, 2008

jsc september 2008 refresh

Filed under: jsc — Tags: , , , , , , , — zproxy @ 7:04 am

Some updates to the compiler and the framework.

Download jsc here. (Others already have!)

Added a WPF template.

Visit our google groups and the google site.

Tutorials to read when just starting with jsc:

This release contains the following Project Templates:

OrcasAvalonApplication – WPF Application, C# to JavaScript, C# to ActionScript

OrcasAppletApplication – C# to Java Applet
OrcasFlashApplication – C# to ActionScript
OrcasScriptApplication – C# to JavaScript
OrcasVisualBasicFlashApplication – VB.NET to ActionScript
OrcasVisualBasicScriptApplication – VB.NET to JavaScript
OrcasWebApplication – C# to JavaScript as Microsoft Web Application
OrcasWebSite – C# to JavaScript as Microsoft ASP.NET Web Site
OrcasJavaConsoleApplication – C# to Java as Console Application
OrcasNativeJavaConsoleApplication – C# to Java as Console Application with JNI bindings. (missing)

Have a look at some old screencasts:

FlashAvalonQueryExample

This is a WPF application based on the new OrcasAvalonApplication template. In debug mode jsc is not invoked and you can develop and debug the application as a regular one yet in release mode, the jsc is invoked at the post build event effectivly creating a javascript and an actionscript version for you. This example uses LINQ. See it in SVN here.

What does this example do? Based on a list of flickr images and a filter that defines a part of the image to be matched it returns a list of images and loads them over the network.

While developing with jsc, one must keep in mind the limits as only a minimum featureset is supported.

Advertisements

March 16, 2008

jsc:actionscript now with anonymous types

Filed under: jsc — Tags: , , , — zproxy @ 1:05 pm

I was able to update jsc and now it supports anonymous types for projects targeting actionscript.

Starting today you can now use syntax like this:

    var query = from i in __users

                where i.ToLower().Contains(user_filter)

                let name = i.Trim()

                let isspecial = i.ToLower().Contains(user_filter2)

                select new { isspecial, length = name.Length, name };

Download latest jsc here.

For feature comparison between projects that target javascript and actionscript see those examples:





February 10, 2008

C# To ActionScript, Initial LINQ Support

Filed under: jsc — Tags: , , , , , — zproxy @ 5:18 pm

I am introducing LINQ for ActionScript – you can now start writing your flash applications in c# using linq and convert it to actionscript via jsc compiler.

How does the generated code compare to the original

In c# the code looks like this:

foreach (var v in from i in __users

where i.Trim().ToLower().Contains(user_filter)

select i.Trim())

{

result.text += “result: “ + v + “\n”;

}

The generated ActionScript looks like this:

enumerator_15 = __Enumerable.Select_100663437(__Enumerable.Where_100663439(SZArrayEnumerator_1.op_Implicit_100664110(__users), new __Func_2(CS___8__locals15, __IntPtr.op_Explicit_100665307(“__ctor_b__8_100663306”))), FlashLinqToObjects___c__DisplayClassf.CS___9__CachedAnonymousMethodDelegate13).GetEnumerator_100664907();

try

{

while (enumerator_15.MoveNext_100665359())

{

v = enumerator_15.get_Current_100665499();

this.result.text = this.result.text+ “result: “+ v+ “\x0a”;

}

}

finally

{

if (!(enumerator_15 == null))

{

enumerator_15.Dispose_100665605();

}

}

New example project:



Download latest the jsc version here.

Create a free website or blog at WordPress.com.