- Advertising model
- Sponsorship model
- Licensing model
- Portal model
- Premium model
- Subscription model
- Micropayment model
- Rental model
- Ransom model
- Patronage model
Update: See more at benlavender.com
Update: See more at benlavender.com
Yes another rep, another rep, because that will make my dream turn into a reality
via MM
Yet another WPF powered flash game is ready for you to play. The game is written in C#. Let me know if you’d also want to see the source.
Today I have extended the ExposedFunctions example. In our scenario we have written a javascript library in c# with jsc and we would like to consume some of its exposed functionality. We are going to edit our html file with Visual Studio inside the WebApplication1 subproject.
In the previous version the API consumer was only able to set text and index fields.
This time around the consumer is able to optionally specify mouse handlers and invoke GetString function on demand in javascript.
In this html file I have added two new buttons to consume the exposed API. The Example2 button will react on mouseover and mouseout events. Clicking on the data will invoke the onclick handler in which we will invoke the C# code to provide us some text to be displayed.
In this example I am going to demonstrate how to write a java applet with a background thread.
Here is a list of the use cases for code written as such:
Additionally I have added support for mouse enter and leave events the java way. While in .net it is easy to subscribe to events using anonymous delegates, such a feature is not yet supported by jsc compiler for java target. It could be resolved in the future releases by adding support for generics and build dynamic invokation on reflection. Google App Engine and Android markets are probably going to trigger that update.
I have created a simple infinite incrementing loop to serve as our business layer. There is a special class ThreadedAction, which abstracts away thread creation, which in turn differs from .net to java from being delegate based to being interface based.
24 while (true)
25 {
26 Value++;
27
28 // we should be running on our own thread
29 // which enables us to loop forever and sleep when tired
30 Thread.Sleep(100);
31 }
As I enjoy the AtDelay and AtInterval extension methods I make use of while programming for actionscript and javascript, I had to implement something similar for the threading API. Therefor spawning a new thread is dead simple:
57 CurrentThreadedAction = 0.AtDelay(Current);
The assembly has been defined as a console exe. Hitting F5 in debug build will show you the console asking your input when to stop the computation.
We now saw that our threaded application does run inside .net. It is time to run it on java virtual machine. To do that we need to build our project with release build. This will trigger jsc to genereta java source code and afterwards java compiler will add final magic.
You cannot just press F5 now, instead you should start run.jar.bat. I am using Scite and by double clicking on the bat file Scite shows up in which I can press F5.
Notice that, only the title is different.
Console applications are cool, but applets also have its role to play in our example. The applet form is set up in two steps. In file DemoApplet.Designer.cs I am going to define the buttons and attach handlers.
37 this.Button3 = new Button {};
38 this.Button3.setLabel(“Compute”);
39 this.Button3.addMouseListener(new Button3_MouseEnter_Handler { Target = this });
40 this.Button3.addMouseListener(new Button3_MouseExit_Handler { Target = this });
41
42 base.add(Button3);
I know you would rather use delegates – I would, but I cannot just yet. In file DemoApplet.cs I am going to define the actual handlers.
97 #region [this.Button3_MouseEnter]
98 [Script]
99 class Button3_MouseEnter_Handler : MouseListener_MouseEnter
100 {
101 public ThreadingExample Target;
102
103 protected override void Invoke()
104 {
105 Target.Button3_MouseEnter();
106 }
107 }
108 #endregion
109
110 public void Button3_MouseEnter()
111 {
112 this.Button1.Enabled = false;
113 this.Button2.Enabled = false;
114
115 this.MyComputation.Start();
116
117 this.Button1.setLabel(“start @ “ + MyComputation.Current.Value);
118 this.Button2.setLabel(“Stop computing”);
119
120 }
In the applet I could start the computation either by explicitly clicking on the start button or hovering your mouse on the third button.
In this example I demonstrated how to write a threaded applet which handles mouse enter and mouse leave events for starting and stopping computation.
| ThreadingExample |
![]() |
Manfred Weber hat ein Talk gegeben, wo er ganz kurz alles, was mit dem Flash Gamez zu tu tun hat, zusammen genommen hat.
Nachdem Ihren Spiel fertig ist, passen sie auf für die rightige Reihenfolge:
Die folgende Artikkeln von Florian Wein sind auch ein Muss für lesen. Ich finde sie ech gut und interessant.
I have prepared an example to demonstrate how to expose your C# coded function for scripting.
| ExposedFunctions |
|
Read the commented source code of that project for better understanding.
The short anwser to the problem looks like this:
31 [Script(NoDecoration = true)]
32 public static void ExposedFunctions_AddData1(Data1 e)

Whole team
Team Lead
via RoyOsherove
See also: The Human Infrastructure Game by Dan

Consider the following aspects while at management just like they do at the US Navy.
Honor. Courage. Commitment. Not bad principles for any company.
Check out this cool java game
See also:
Dictionary.com is even providing a word list to help you get started! The only rules for using this list is to mark on the Title Screen of your game that it is being powered by “dictionary.com”.
While developing for java with jsc you could run your application on .net for debugging if one of the following condition has been met:
Even if I am talking about Java, this idea applies on other platforms jsc has support for including ActionScript, JavaScript and PHP.
You application will not talk directly to the underling platform. Every feature must be implemented via a BCL class. This ensures your application will run on .net and after crosscompilation via jsc also on the target platform java. The downside is, your application will include the sourcecode BCL classes, which for embedded systems could be a problem. For Java Card 2.0 you must use only one namespace or package. To overcome that limitation the next option should be considered. On the other hand, your application could also be recompiled for another platform with no effort on your part, assuming the target has BCL classes ready for use. This is why currently you are able to write a .net application for Windows Presentation Foundation and have it compilable to javascript and actionscript.…
| AvalonExampleGallery |
|
Your application will directly talk to the underling platform. You need to manually reimplement the external API via available BCL classes. You might not be able to implement all features the platform has to offer, which in turn limits your debugging experience. This is considered a better option for embedded systems
At this time my compiler does not support generics nor delegates for java, which it could in the future. Even though I was more biased toward actionscript and javascript lately java has gained some significant importance. Here is a list to name a few reasons I am investing into jsc java support:
If you are interested to learn more, let me know.
Life is too short not to do what you love to do…
The other day I was reading the standard output of another process I had created. If the output happened to be somewhat longer then the application would hang. I found that really odd and started to blame the external application at first, but after consulting to google™ I was told what I was doing it wrong. The compiler could of had warned be about the issue but it didn’t and I was left with a hanging application, which sucked. In short you have to make sure your StandardError stream wont pile up its precious buffer of 4096 bytes.
[...] you have a more general problem, which is the possibility that the standard output
will wind up blocked because you haven’t been reading from standard error.In most cases, this may not be a problem, assuming the output to
standard error is brief. But it’s a basic issue with redirection of the
Process class standard i/o streams: if you redirect more than one, you
need to make sure you are using some form of asynchronous access to send
or receive data from all of them as appropriate. Otherwise, the console
application winds up blocked trying to read or write to one of the
streams, causing a form of deadlock.The documentation for the Process class has a good, detailed explanation
of this. It’s helpful to read that if you intend to redirect the streams.
Learn something new each day… I guess one day google will be able to have a look at your problem and simply suggest the fix, but until then that remains as a manual feature.
Theme: Shocking Blue Green. Blog at WordPress.com.