“PlayScript is an open source Adobe ActionScript compatible compiler and Flash compatible runtime that runs in the Mono .NET environment, targeting mobile devices through the Xamarin Studio MonoTouch and Mono for Android platforms” says the first sentence of its readme on GitHub. I have written this tutorial for those who want to quickly start playing with Playscript.
We will create simple iOS app In Xamarin Studio. This app will use native control (UIButton) and Actionscript 3 class which will supply button’s label. This tutorial targets developing with Monotouch. This means that you need corresponding license to compile the app on real device. It’s worth to note that all steps in this article is based on current versions of available binaries and source code (it’s 14 Apr 2013 today). And some of them may not be required in the future.
After spending hours trying to compile Playscript-mono on Windows (Windows 7, x64), I have realized that I should share my final procedure. Please, note, that I am not command line savvy person and actually this was my first large compilation. Thus, I can not guarantee that it will work in all cases. But hopefully it will be helpful for someone.
If you do not want to bother with building Plascript from source, you can find links to compiled binaries on Playscript GitHub page.
This is the test to check relative difference in performance on mobile device.
- Actionscript 3 code compiled with ASC2 (AIR 3.6)
- Actionscript 3 code compiled with Playscript-mono compiler
- C# code compiled with Playscript-mono compiler (Monotouch)
- Objective C code
Results (on iPad 3):
- AS3 (ASC2) – 390 milliseconds
- AS3 (Playscript) – 810 milliseconds
- C# – 800 milliseconds
- ObjC – 460 milliseconds
Zynga recently released Playscript compiler, which can compile Actionscript 3 code for Mono runtime (GitHub).
I did very basic benchmark test for Vector access, to see the difference in performance between the app produce with “native” compiler and Playscript compiler. Both apps was compiled to run on iOS device.