In this small tutorial I’ll show how to get starting using redtamarin to compile actionscript classes and run as shell script.
Download redtamarin from the project page. Put it in /opt/redtamarin and create a link to it using:
sudo chmod +x /opt/redtamarin/redshell
sudo ln -s /opt/redtamarin/redshell /usr/local/bin/redshell
You could test your installation writing a ‘Hello World!’.
hello.as:
To run that code type: redshell hello.as
Now let’s create class, Person.as:
package {
public class Person {
public var name;
public function Person(name:String){
this.name = name
}
public function sayHello(to:String):void {
trace("Hello " + to + ", I'm " + this.name)
}
}
}
Now compile it with java -jar /opt/redtamarin/asc.jar -AS3 -import /opt/redtamarin/builtin.abc -import /opt/redtamarin/toplevel.abc Person.as
modify hello.as to:
import Person;
var p:Person = new Person("Everson");
p.sayHello("World");
And compile it: java -jar /opt/redtamarin/asc.jar -AS3 -import /opt/redtamarin/builtin.abc -import /opt/redtamarin/toplevel.abc -import Person.abc hello.as. Note that we are importing the compiled Person.abc.
Running the example: redshell Person.abc hello.abc. I think it’s possible to compile all classes into a single abc but that didn’t work for me.
That’s it. Cool, huh? Now you can go write cool scripts using actionscript.