Actionscript to Android
Over the next few weeks.. I’m going to write out some very simple to progressively more advanced Actionscript to Android comparisons. Since it’s all Java based, it should be fairly simple to see the differences and merge your way from AS3 to Android. Instead of explaining a bunch of stuff, I’ll just jump directly into it.
Actionscript 3.0
package com.android.hello { import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity{ /** Called when activity is first created */ public override onCreate( savedInstanceState:Bundle ):void { super.onCreate( savedInstanceState ); var tv:TextView = new TextView( this ); tv.setText("Hello, Android"); setContentView( tv ); } } }
Android (Java)
package com.android.hello; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); TextView tv = new TextView(this); tv.setText("Hello, Android"); setContentView(tv); } }
This is a very simple example that helps show the differences in syntax.
| Actionscript 3 | Android (Java) |
|---|---|
| - Enclose package in brackets - Override after “public” - Return type (void) AFTER parameters - Variable type “var varname:Type” |
- Do not enclose package - Override set before method - Return type (void) BEFORE method name - Variable type “Type varname” |
Tags: actionscript, Actionscript 3.0, android, java





February 19th, 2009 at 11:46 am
Thank you very useful and simple explanation, so i’ll go for android ASAP i can get a Android phone!!
September 15th, 2009 at 12:07 am
[...] Actionscript to Android [...]
July 15th, 2010 at 10:58 am
[...] and for Flash devs: Actionscript to Android [...]