-
Notifications
You must be signed in to change notification settings - Fork 23
Workflow
Here we try to present different kind of workflow about how to work with Redtamarin.
This list is off course not exhaustive and we would be happy to add more depending on users comments and feedback.
For dev
- who already know Flash Builder
- not too comfortable with compilers and theirs options
- that do not want to bother with ABC and would rather use
something they already know: SWC
What you need
- install the Redtamarin SDK
- a patched Flex SDK
- Flash Builder 4.6 or 4.7
TODO
This is a preview on how it should work
we need a unique wiki page per workflow
- copy the Flex SDK to another directory
- replace
playerglobal.swc
withredtamarin.swc
- add the new Flex SDK path to Flash Builder
Create a new ActionScript 3.0 project, eg. the main class need to be *.as
(not *.mxml
).
for example:
package
{
public class test_one
{
public function test_one()
{
trace( "hello world" );
}
}
}
test_one is your main class.
When compiled from the IDE this will produce bin-debug/test_one.swf
As long as you don't use SWC libraries and only use the Redtamarin API
you can run the SWF "as is" from one of the Redtamarin shell
$ redshell bin-debug/test_one.swf
now add a SWC library, for example: base64lib.swc
you can find it here on the base64lib project
use the library in your code
package
{
import encoding.base64.encodeBase64;
public class test_one
{
public function test_one()
{
trace( "hello world" );
var str:String = "hello world";
var b64:String = encodeBase64( str );
trace( "string: " + str );
trace( "base64: " + b64 );
}
}
}
This will not work, because when Flash Builder compile the SWF using MXMLC
the main class definition is declared first, and the SWC library declarations
are declared after.
So when your main class need to use the encoding.base64.encodeBase64
definition,
even if the definition is loaded, the definition is not available yet.
This is a problem of runtime, when the Redtamarin shell runtime load a SWF
it load the code definitions in the order of the declaration.
To fix this problem we added a new API Program.start()
which allow us to be sure all definitions are available to the runtime
before using them.
You use it after the main class package definition
package
{
import encoding.base64.encodeBase64;
public class test_one
{
public function test_one()
{
trace( "hello world" );
var str:String = "hello world";
var b64:String = encodeBase64( str );
trace( "string: " + str );
trace( "base64: " + b64 );
}
}
}
import shell.Program;
Program.start( "test_one" );
Now after compiling the SWF from the IDE, if you run
$ redshell bin-debug/test_one.swf
everything will execute in the correct order and output
hello world
string: hello world
base64: aGVsbG8gd29ybGQ=
Notes:
- you can only define one
Program.start()
- the SWF need to be compatible with Redtamarin
- you can use all of Redtamarin API defined in
redtamarin.swc
- you can use external SWC libraries
that are compatible with Redtamarin
- you can use all of Redtamarin API defined in
- You can not use a SWC that would have been built with CrossBridge/FlaCC
- You can not use a SWC that was compiled for
playerglobal.swc
orairglobal.swc
if this SWC use API that are implemented natively in the Flash Player runtime
or the Adobe AIR runtime and are not available in the Redtamarin shell runtime- compatible example
you want to useflash.system.System
that's OK, it will work as this one is defined and implemented in Redtamarin API - incompatible example
you want to useflash.display.Sprite
that will not work, Redtamarin at best provide a mock implementation of this class but has no idea how to actually render aSprite
on the screen
- compatible example