The book of inspiration

February 22, 2010

JSC Ultra to reuse native source code

Filed under: jsc — Tags: , , , , , — zproxy @ 9:48 am

As advertised the developers will be able to seamlessly create flash sprites and java objects inside their javascript applications in C# via the jsc ultra offering. What if they could just drop some native source code and be able to reuse them in C#?

At the moment only the HTML web page is converted to DOM building code which looks like this under reflector.

In the future releases the native source codes could be parsed and placed in the correct location based on their namespace for their respective back-end compilers.

Seems like I will need source code parsers to pull it off. First step is to generate a stub. The next step would be to convert the native source to IL. If we go just for the first step, then one can surely benefit from some native language specific syntax constructs.

Update: The second pass would mean that the native back-end compiler does it’s job and jsc will go and decompile JVM or AVM to IL as jsc is not about compiling source to IL.

Then you could consume the AboutApplet.java  in your javascript code like this:

42 var Applet1 = new AboutApplet();

43

44 Applet1.Method1(“hello world”);

45

46 var Applet1Element = Applet1.AttachAppletToDocument();

47

48 Applet1Element.style.border = “1px solid red”;

This will create a red java applet in your browser.

The AboutApplet.java should could look something like this:

1 // PromotionWebApplication1.AboutApplet.dll

2 package PromotionWebApplication1;

3

4 import java.applet.Applet;

5 import java.awt.Component;

6 import java.awt.Container;

7 import java.awt.image.ImageObserver;

8 import java.awt.Panel;

9

10 public final class AboutApplet extends Applet implements ImageObserver

11 {

12

13

14 public AboutApplet()

15 {

16 super();

17 }

18

19

20 public final void Method1(String p)

21 {

22 }

23

24 }

Ch

Cool features ahead. Including HTML5 🙂 Including an actual installer!

jsc has now a twitter feed!

PS. What about .class, .jar, .swf, .swc? 🙂 I surely would like to pull media from online .swf files just to be able to recompile them into my own application.

Hey Compiler that flash game there has nice logo and sound, could you go ahead and make them accessible for me in the code? Thanks! 🙂

October 1, 2009

jsc is awesome

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

Now that I got your attention:

There is a new release for jsc with two new screencasts. This time around you are able to omit [Script] attribute and ditch the tools/build.bat. The jsc solution now includes  the jsc.meta compiler which will talk to the other compilers for you.

I am also experimenting with pre compilers. For example the Forms example makes use of TextualUserControl and TextComponent. Without getting too technical they generate a new assembly and add the reference to your csproj file. This opens up some really interesting possibilities. I will talk more about this in future posts.

Future pre compilers in jsc solution could include automatic stub generators for java jar files and for flash swf and swc files.

Open javascript version.

Open actionscript version.

Open javascript version.

Open java version:

demobutton.png

PS. Video parameters “&w=800&fmt=18”

June 10, 2009

The Cloud Effect

Filed under: jsc — Tags: , , , — zproxy @ 2:15 pm

This example is a port of CloudEffect.



May 29, 2009

Using FLINT particle system from jsc

Filed under: jsc — Tags: , , , , , , — zproxy @ 6:00 pm
FLINT particle system

Moristar asked how to use an external libray from within a c# flash project. The short answer is yes you can, but you’d have to define stubs.

The long anwser…

In .net when you are talking to COM an interop assembly is used. The interop assembly defines types which represent the actual types to be used. That assembly is generated automatically at the time you reference the COM assembly.

It would be nice to be able to simply add a reference to a SWC file and use the features it defines, but currently it is not supported. A tool could be created which would read the SWC file and create the stub library. Currently this needs to be done manually.

Previous example

A year ago I did exactly this to get to use Google Maps with jsc. Today I updated its source to the latest Google Maps API version.

FlashGoogleMapsExample[source:svn]

In this post I am going to do this to demonstrate the same techniques for Flint and also comment on what I am doing.

(more…)

May 15, 2009

URLRequestHeader

Filed under: jsc — Tags: , , — zproxy @ 8:35 am

The other day a developer named Carlo emailed me noted that currently URLRequestHeader is not exposed via ScriptCoreLib. In response to that I exposed those classes and created an example solution to demonstrate it. You would need to redownload jsc to get it ofcourse.

Before going into that I would like to show how one could add a native type that is not yet defined by other assemblies like ScriptCoreLib. In your assembly you would need to define a new type like this:

6 namespace ScriptCoreLib.ActionScript.flash.net

7 {

8 // http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequestHeader.html

9 [Script(IsNative = true)]

10 public class URLRequestHeader

11 {

The compiler will later then assume that this type is provided by the platform itself or imported by some other means and use it as a native type.

The actionscript livedocs had a nice example which I translated to C#.

44 var loader = new URLLoader();

45

46 var header = new URLRequestHeader(“XMyHeader”, “got milk?”);

47

48 t.appendText(“\n” + this.loaderInfo.url);

49 t.appendText(“\nUsing relative path…”);

50

51 var request = new URLRequest(“../WebForm1.aspx”);

52 var data = new DynamicContainer { Subject = new URLVariables(“name=John+Doe”) };

53 data[“age”] = 23;

54

55 request.data = data.Subject;

56 request.method = URLRequestMethod.POST;

57 request.requestHeaders.push(header);

58

59 loader.complete +=

60 args =>

61 {

62 t.appendText(“\n” + loader.data);

63 };

64

65 loader.load(request);

In this demo I am sending three elements of data to the server:

  1. header XMyHeader
  2. post parameter name
  3. post parameter age

As we need a server to echo something back for us to see it works I added a new ASP.NET Web Application to the solution. The flash file generated by the jsc compiler will be copied to a folder Generated. The generated files are not included in the svn. This is why the solution will show exclamation marks on the first build.

headerserver

The WebForm1 implements the echo service like this:

10 public partial class WebForm1 : System.Web.UI.Page

11 {

12 protected void Page_Load(object sender, EventArgs e)

13 {

14 var data = new

15 {

16 XMyHeader = this.Request.Headers[“XMyHeader”],

17 name = this.Request.Params[“name”],

18 age = this.Request.Params[“age”],

19

20 };

21

22 this.Response.Write(“hi! “ + data.ToString());

23 this.Response.End();

24 this.Response.Close();

25 }

26 }

Running  it in the browser will give us the following view including the current URL and the text returned by the server.

headerhtml

The source code for this example is available here:

http://jsc.svn.sourceforge.net/viewvc/jsc/examples/actionscript/URLRequestHeaderExample/

As this is a dirty fast example – If anything needs clarification do let me know.

April 6, 2009

C# To ActionScript and Alchemy

Filed under: jsc — Tags: , , , — zproxy @ 7:14 pm

Some years ago I added some minimal C source code generation support to my jsc compiler. This time I decided to polish it up a little bit and see what would it look like to develop a flash application with alchemy in c#.

This example is a port from this Alchemy plasma experiment. I made it in c#, changed the color and added the jsc logo.

Overview

Writing code in c#? That’s plain crazy. To make it easier to comprehend – here is an overview diagram of what is really happening.

flashalchemy1

Hand written C# sourcecode

As you can see, there are multiple compilers doing the hard work so you could have that final flash binary file. The C# code that will be converted by jsc compiler looks like this:

   14 static int width;
   15     static int height;
   16
   17     static uint[] palette;
   18     static uint[] plasma;
   19     static uint[] newPlasma;
   20
   21
   22     static AS3_Val generatePlasma(object self, AS3_Val args)
   23     {
   24       AS3_h.AS3_ArrayValue(args, "IntType, IntType", __arglist(ref width, ref height));
   25
   26       palette = new uint[256];
   27       plasma = new uint[width * height];
   28       newPlasma = new uint[width * height];
   29
   30       for (var x = 0; x < 256; x++)
   31       {
   32         var b = (int)(128.0 + 128 * Math.Sin(Math.PI * x / 16.0));
   33         var g = (int)(128.0 + 128 * Math.Sin(Math.PI * x / 128.0));
   34         var r = 0;
   35
   36         uint color = (uint)(r << 16 | g << 8 | b);
   37
   38         color |= 0xff000000u;
   39
   40         palette[x] = color;
   41       }
   42
   43       int index = 0;
   44
   45       for (var x = 0; x < width; x++)
   46       {
   47         for (var y = 0; y < height; y++)
   48         {
   49           uint color = (uint)((
   50             128.0 + (128.0 * Math.Sin(x / 16.0)) +
   51             128.0 + (128.0 * Math.Sin(y / 8.0)) +
   52             128.0 + (128.0 * Math.Sin((x + y) / 16.0)) +
   53             128.0 + (128.0 * Math.Sin(math_h.sqrt(x * x + y * y) / 8.0))
   54           ) / 4);
   55
   56
   57           color |= 0xff000000u;
   58
   59           plasma[index++] = color;
   60         }
   61       }
   62
   63
   64       return AS3_h.AS3_Ptr(plasma);
   65     }
   66
   67     static AS3_Val shiftPlasma(object self, AS3_Val args)
   68     {
   69       var shift = 0;
   70       var index = 0;
   71
   72       AS3_h.AS3_ArrayValue(args, "IntType", __arglist( ref shift));
   73
   74       for (var x = 0; x < width; x++)
   75       {
   76         for (var y = 0; y < height; y++)
   77         {
   78           var paletteIndex = (int)( (uint)(plasma[index] + shift) % 256);
   79           newPlasma[index] = palette[paletteIndex];
   80           index++;
   81         }
   82       }
   83
   84       return AS3_h.AS3_Ptr(newPlasma);
   85     }

Generated C source code for Alchemy

After jsc compiler has converted it to asni c it will look like this:

   30
   31 int FlashPlasma_Alchemy_Program_width;
   32 int FlashPlasma_Alchemy_Program_height;
   33 unsigned int* FlashPlasma_Alchemy_Program_palette;
   34 unsigned int* FlashPlasma_Alchemy_Program_plasma;
   35 unsigned int* FlashPlasma_Alchemy_Program_newPlasma;
   36
   37 AS3_Val FlashPlasma_Alchemy_Program_generatePlasma(void* self, AS3_Val args)
   38 {
   39     int x;
   40     int b;
   41     int g;
   42     int r;
   43     unsigned int color;
   44     int index;
   45     int y;
   46
   47     AS3_ArrayValue((AS3_Val)args, (char*)"IntType, IntType", &FlashPlasma_Alchemy_Program_width, &FlashPlasma_Alchemy_Program_height);
   48     FlashPlasma_Alchemy_Program_palette = (unsigned int*) malloc(sizeof(unsigned int) * 256);
   49     FlashPlasma_Alchemy_Program_plasma = (unsigned int*) malloc(sizeof(unsigned int) * (FlashPlasma_Alchemy_Program_width * FlashPlasma_Alchemy_Program_height));
   50     FlashPlasma_Alchemy_Program_newPlasma = (unsigned int*) malloc(sizeof(unsigned int) * (FlashPlasma_Alchemy_Program_width * FlashPlasma_Alchemy_Program_height));
   51
   52     for (x = ((int)0); (x < 256); x++)
   53     {
   54         b = ((int)((signed int)((128 + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)((3.14159265358979 * ((double)(x))) / 16)))))));
   55         g = ((int)((signed int)((128 + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)((3.14159265358979 * ((double)(x))) / 128)))))));
   56         r = ((int)0);
   57         color = ((unsigned int)(((r << 16) | (g << 8)) | b));
   58         color = ((unsigned int)(color | -16777216));
   59         FlashPlasma_Alchemy_Program_palette[x] = color;
   60     }
   61
   62     index = ((int)0);
   63
   64     for (x = ((int)0); (x < FlashPlasma_Alchemy_Program_width); x++)
   65     {
   66
   67         for (y = ((int)0); (y < FlashPlasma_Alchemy_Program_height); y++)
   68         {
   69             color = ((unsigned int)((unsigned int)(((((((((128 + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)(((double)(x)) / 16)))) + 128) + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)(((double)(y)) / 8)))) + 128) + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)(((double)((x + y))) / 16)))) + 128) + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)(sqrt((double)((double)(((x * x) + (y * y))))) / 8)))) / 4))));
   70             color = ((unsigned int)(color | -16777216));
   71             FlashPlasma_Alchemy_Program_plasma[index++] = color;
   72         }
   73
   74     }
   75
   76     return  (AS3_Val)AS3_Ptr((void*)FlashPlasma_Alchemy_Program_plasma);
   77 }
   78
   79 AS3_Val FlashPlasma_Alchemy_Program_shiftPlasma(void* self, AS3_Val args)
   80 {
   81     int shift;
   82     int index;
   83     int x;
   84     int y;
   85     int paletteIndex;
   86
   87     shift = ((int)0);
   88     index = ((int)0);
   89     AS3_ArrayValue((AS3_Val)args, (char*)"IntType", &shift);
   90
   91     for (x = ((int)0); (x < FlashPlasma_Alchemy_Program_width); x++)
   92     {
   93
   94         for (y = ((int)0); (y < FlashPlasma_Alchemy_Program_height); y++)
   95         {
   96             paletteIndex = ((int)(((unsigned int)((((unsigned long)(FlashPlasma_Alchemy_Program_plasma[index])) + ((signed long)(shift))))) % 256));
   97             FlashPlasma_Alchemy_Program_newPlasma[index] = FlashPlasma_Alchemy_Program_palette[paletteIndex];
   98             index++;
   99         }
  100
  101     }
  102
  103     return  (AS3_Val)AS3_Ptr((void*)FlashPlasma_Alchemy_Program_newPlasma);
  104 }

Generated ActionScript by Alchemy

Now that was the basic ansi C source code. Alchemy will convert it to special actionscript which will look like good old assambler:

 9002 i0 =  ((__xasm<int>(push((mstate.ebp+8)), op(0x37))))
 9003 i1 =  ((__xasm<int>(push((mstate.ebp+12)), op(0x37))))
 9004 i2 =  ((__xasm<int>(push((i0+16)), op(0x37))))
 9005 i3 =  ((__xasm<int>(push((i1+16)), op(0x37))))

Summary

At this time it is quite hard to set up such an environment due to cygwin quirks, but it does enable some interesting scenarios. If you would like to know more about writing for flash alchemy in C# just let me know.

January 7, 2009

InteractiveOrdering via Avalon

Filed under: jsc — Tags: , , , — zproxy @ 8:25 am

Today I released another example project which demonstrates that you could develop an application for WPF but have it running as XBAP and additionally on flash player and javascript enabled browsers aswell.

In this application you are being aided in a comparison process and as a result you will get a preference list.

  1. XBAP version (IE)
  2. ActionScript version
  3. JavaScript version Via Coral Cache
  4. [source:svn]

Othe r posts in this series:

  1. WPF subset powered by Flash and DHTML
  2. WPF subset powered by Flash and DHTML Part 2
  3. AvalonExampleGallery

November 20, 2008

AvalonWebApplication with PHP backend

Filed under: jsc — Tags: , , , , , , , — zproxy @ 7:41 pm

I have created a new project template that demonstrates most of what jsc is capable of. Soon I will publish it on the sourceforge with a tutorial how to get started using it.

Long story short – Here is an application which demonstrates the following features all written in C#:

  1. PHP Backend
  2. JavaScript (WPF)
  3. ActionScript (WPF)
  4. Java Applet

Update: Moved the example to sourceforge and removed the querystring switch.

November 19, 2008

C To ActionScript via Alchemy

Filed under: jsc — Tags: , , , — zproxy @ 6:54 am

News by BrokenBlog:

Alchemy to compile your C to ActionScript.

How does Alchemy work?

Alchemy works by converting LLVM bytecode to ActionScript 3.0 (AS3) source through an Adobe-authored LLVM back-end. This AS3 source is then compiled using a special version of the ActionScript Compiler to ActionScript bytecode (ABC). This ABC output is then bundled into either a SWF or a SWC depending on your compile options. The resulting SWFs can be executed using Flash Player or bundled into an AIR app. The resulting SWCs can be built into a larger Flash, Flex or AIR application just like any other SWC.

It looks like my jsc project could benefit from this project as jsc also generates actionscript sourcecode. All I need to do is to find out those special version actionscript keywords (not there yet?) and invoke the special version as3 compiler. There isn’t much in the forums yet.

November 5, 2008

Avalon FreeCell

Filed under: jsc — Tags: , , , , , , , , , , — zproxy @ 7:41 pm

The next game powered by jsc has been released. This game works on .net, on javascript and on flash player.

The game is also available at Newgrounds over here and at WidgetBox.

Use Internet Explorer to open the Windows Presentation Foundation (XBAP) version.

Use Internet Explorer or Safari to open the JavaScript version.

The sourcecode is at google code.

October 22, 2008

jsc October Refresh

Filed under: jsc — Tags: , , , , , , — zproxy @ 8:24 pm

Some updates to the compiler and the framework.

Download jsc here. (Others already have!) Older releases are here.

Visit our google groups and the google site.

Tutorials to read when just starting with jsc:

This release contains the following Project Templates:

OrcasAvalonApplicationWPF 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

Have a look at some old screencasts:

Have a look at the Avalon Gallery, note that it is actually a WPF Application.






September 30, 2008

WPF subset powered by Flash and DHTML Part 2

Filed under: jsc — Tags: , , , , , , — zproxy @ 12:41 pm

Today I released another example project which demonstrates that you could develop an application for WPF but have it running as XBAP and additionally on flash player and javascript enabled browsers aswell.

  1. XBAP version (IE)
  2. ActionScript version
  3. JavaScript Preloader version Via Coral Cache
  4. JavaScript ClickOnce version
  5. JavaScript version

The javascript version has been tested with the following browsers:

  • FireFox 3.0.1
  • IE 7.0.6
  • Safari 3.1.2

You can look at the published files here or you can look at the source code here and here.

Other posts in this series:

  1. WPF subset powered by Flash and DHTML

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.

August 16, 2008

WPF subset powered by Flash and DHTML

Filed under: jsc — Tags: , , , , , , — zproxy @ 9:43 pm

Today I released an example project which demonstrates that you could develop an application for WPF but have it running as XBAP and additionally on flash player and javascript enabled browsers aswell. Isn’t this more like WPF Everywhere 🙂 ?

  1. XBAP version (IE)
  2. ActionScript version
  3. JavaScript Preloader version
  4. JavaScript ClickOnce version
  5. JavaScript version

The javascript version has been tested with the following browsers:

  • FireFox 3.0.1
  • IE 7.0.6
  • Safari 3.1.2

You can look at the published files here or you can look at the source code here and here.

Some currently by ScriptCoreLib.Avalon library supported features are:

  1. Canvas
  2. TextBox
  3. Rectangle
  4. Image
  5. Cursor.None
  6. DispatcherTimer

Neat huh?

Update: Chris is working on silverlayout – wpf inside as3.

July 17, 2008

Two New Examples

Filed under: jsc — Tags: , , , , , , — zproxy @ 3:11 pm




The RayCaster is based on this source and is just what you need to when you start making one of these Wolf3D games. The ZIndex demo shows how you could emulate the missing z-index property in flash 9.

June 29, 2008

FlashTowerDefense1:MP Version 9

Filed under: jsc — Tags: , , , , , , , , — zproxy @ 2:18 am

Yet another screencast of my sheep rampage. This time you can kill coplayers, and we can change weapons. GTA style 🙂 Do you remmeber the keys? Oh, and I had to drop the wave by days feature for this version…

And look what happened when I submitted this game to Newgrounds 🙂

http://nonoba.com/zproxy/flashtowerdefense1mp

Play at Googlepages.

Game published on Newgrounds.

Embed it as Google Gadget here or here or here. View all videos of this game.

Add to Google

View source. Remember this is still flash, but the application is written in C#.

June 15, 2008

FlashTowerDefense1 v6.1

Filed under: examples, games, jsc — Tags: , , , , , , — zproxy @ 9:55 pm
Game updated to version 6. Player can now exit the machinegun and chase those sheep with a shotgun.

FlashTowerDefense1

You are in the command of a machine gun tower and you are raided by mad sheep and enemy warriors. Your mission is to shoot them down.

  • Size: 800×600
  • Category: Shooting
  • Tags: machinegun, sheep, blood
  • Content Rating: Everyone

Instructions: Aim at the enemy unit and hold down the mouse until the unit is terminated by gunfire.

Game published on Nonoba.
Game published on Multigames.
Game published on Newgrounds.

View older blog post or video post..

June 12, 2008

Jsc June Refresh 2

Filed under: jsc — Tags: , , , , , , , , , , — zproxy @ 4:29 pm

Some updates to the compiler and the framework: Download jsc here. (Others already have!)

Added two Java project templates.

Visit our google groups.

Tutorials to read when just starting with jsc:

This release contains the following Project Templates:

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.

Have a look at some old screencasts:

June 7, 2008

FlashTowerDefense On YouTube

Filed under: jsc — Tags: , , , , , , — zproxy @ 2:29 pm

June 6, 2008

Jsc June Refresh

Filed under: jsc — Tags: , , , , , , , , , , — zproxy @ 2:43 pm

Some updates to the compiler and the framework: Download jsc here.

Most important update was fixing the virtual + override semantics for jsc:actionscript. It’ did not allow to combine multiple events for example.

Visit our google groups.

Tutorials to read when just starting with jsc:

This release contains the following Project Templates:

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

Writing code in VB.NET for flash looks like this:

June 4, 2008

FlashTowerDefense1 v2.1

Filed under: actionscript, examples, games, jsc — Tags: , , , , , , — zproxy @ 1:16 pm

A month has passed and $0.20 money has been made. I published this project to try this new trend to monetize your flash game I’ve read about on Emanuel’s blog. My idea is simple – use c# (view source) for coding, translate the project to a actionscript equivalent via jsc and draw yourself some graphics for the game. So far so good. I am now a member of GameBalance, MochiAds and Newsground where you can even visit my profile.

FlashTowerDefense1

You are in the command of a machine gun tower and you are raided by mad sheep and enemy warriors. Your mission is to shoot them down.

  • Size: 640×480
  • Category: Shooting
  • Tags: machinegun, sheep, blood
  • Content Rating: Everyone

Instructions: Aim at the enemy unit and hold down the mouse until the unit is terminated by gunfire.

You can see the stats for MochiAds and Newsground below:


What do you think I should add as a next feature? I’ve already read some of the suggestions and am considering adding them.

  • enemies come as waves
  • powerups
  • building multiple cannons
  • more doodads like trees and bushes

Visit older blog post here.

Update: Game published on Nonoba. View my profile.

Update: Game published on Multigames. View my profile.

April 30, 2008

jsc april refresh 4

Filed under: jsc — Tags: , , , — zproxy @ 2:30 pm

Some minor updates to the compiler and the framework: Download jsc here.

Visit our google groups.

Previous releases contained a serious bug when jsc was being used on a machine without the DIA SDK. It comes with the Visual Studio retail version and I did not realized it before. Now jsc wont crash when the DIA SDK is not installed and method variable names will be autogenerated instead of beeing looked up in the pdb file.

Tutorials to read when just starting with jsc:

How things releate:
jsc

This is how it looks like when writing c# instead of actionscript:
flash

April 20, 2008

jsc april refresh 3

Filed under: jsc — Tags: , , , , — zproxy @ 11:35 am

Some minor updates to the compiler: Download here.

There is a new example for actionscript, where I ported the LightsOut game from its javascript version.

Actionscript Version



Javascript Version



I got the idea originally from this blog post, and made the javascript version almost a year ago.

April 6, 2008

jsc april 2008 refresh

Filed under: jsc — Tags: , , , — zproxy @ 2:45 pm

First some minor updates to the compiler: Download here.

Additionally two new example actionscript projects:





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.

January 20, 2008

C# to ActionScript, initial delegate support

Filed under: jsc — Tags: , , , , — zproxy @ 3:59 pm

The compiler has been modified to support delegates with actionscript.

For example you can now write this, plain and simple, just like in jsc:javascript. The sound demo 2 has been updated with a rotating image and the a text field that is now tracks the mouse.

front.mouseOver += ev => front.textColor = 0x00ff0000;
 


January 13, 2008

C# to ActionScript, MySoundDemo

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

New example is out and new version of jsc too.

Download jsc (c# to javascript)



January 12, 2008

c# to actionscript

Filed under: jsc — Tags: , , , — zproxy @ 6:50 pm

After a long time we now present you c# to actionscript compiler. It is work in progrss, but you can have a sneak peak now 🙂

The concept is that you write c# code in visual studio 2008 or later, let jsc translate your dll or exe to actionscript source code and then let the mxmlc compiler do the final work. Simple, right? 🙂

MyWebCamera

[source:svn]



Blog at WordPress.com.