Class Sprout::MTASCTask
In: bundles/as2/lib/sprout/tasks/mtasc_documentation.rb
bundles/as2/lib/sprout/tasks/mtasc_rdoc.rb
bundles/as2/lib/sprout/tasks/mtasc_task.rb
Parent: ToolTask

Compile sources using the Motion Twin ActionScript Compiler (MTASC).

Like standard Rake file tasks, the name given to the MTASCTask instance should be the file that the task is epected to create. This value can be overridden in the configuration block by using the -output parameter.

  mtasc 'bin/SomeProject.swf' do |t|
    t.main = true
    t.header = '800:600:24'
    t.input = 'src/SomeProject.as'
  end

The above MTASCTask can be aliased for easier typing on the command line as follows:

  desc "Compile SomeProject.swf"
  task :compile => 'bin/SomeProject.swf'

If the MTASCTask has a SWFMillTask as a prerequisite, it will automatically set that task output as the value of the -swf paramter. Additionally, when MTASC pulls in an existing SWF file you no longer need to define the -header parameter as it will use the dimensions and frame rate found in the loaded SWF file. If the -header parameter is set, it will override whatever settings are in the loaded SWF. Following is a short example:

  swfmill 'bin/SomeProjectSkin.swf' do |t|
    t.input = 'assets/skin'
  end

  mtasc 'bin/SomeProject.swf' => 'bin/SomeProjectSkin.swf' do |t|
    t.main = true
    t.input = 'src/SomeProject.as'
  end

Any LibraryTask instances that are added as prerequisites to the MTASCTask will be automatically added to the class_path in the order they are declared as prerequisites.

The following example will add the imaginary libraries :somelib, :otherlib and :yourlib to the class_path in that order.

  library :yourlib
  library :otherlib
  library :somelib

  mtasc 'bin/SomeProjectRunner.swf' => [:somelib, :otherlib, :yourlib] do |t|
    t.main = true
    t.header = '800:600:24'
    t.input = 'src/SomeProjectRunner.as'
  end

At this time, MTASC does not support libraries that are packaged as SWC files. We are considering adding support for SWC files in the near future, if you‘re interested in contributing to this feature, please let us know.

Methods

cp=   cp=   exclude=   exclude=   frame=   frame=   group=   group=   header=   header=   infer=   infer=   input=   input=   keep=   keep=   main=   main=   msvc=   msvc=   mx=   mx=   out=   out=   pack=   pack=   resolve_library   resolve_skin   strict=   strict=   swf=   swf=   trace=   trace=   v=   v=   version=   version=   wimp=   wimp=  

Attributes

include_std  [RW]  Automatically include the installation MTASC ‘std’ library to the class_path.

Public Instance methods

Add a directory path to the class path. This is the list of directories that MTASC will use to look for .as files. You can add as many class_path values as you like. This parameter is an Array, so be sure to append rather than overwrite.

Even though the official MTASC compiler accepts the cp paramter, we have aliased it as class_path, you can use either name in your scripts.

  mtasc 'bin/SomeProject.swf' do |t|
    t.class_path << 'lib/somelib'
    t.class_path << 'lib/otherlib'
    # The following is not correct:
    # t.class_path = 'lib/somelib'
  end

Add a directory path to the class path. This is the list of directories that MTASC will use to look for .as files. You can add as many class_path values as you like. This parameter is an Array, so be sure to append rather than overwrite.

Even though the official MTASC compiler accepts the cp paramter, we have aliased it as class_path, you can use either name in your scripts.

  mtasc 'bin/SomeProject.swf' do |t|
    t.class_path << 'lib/somelib'
    t.class_path << 'lib/otherlib'
    # The following is not correct:
    # t.class_path = 'lib/somelib'
  end

Exclude code generation of classes listed in specified file (format is one full class path per line).

Exclude code generation of classes listed in specified file (format is one full class path per line).

Export AS2 classes into target frame of swf.

Export AS2 classes into target frame of swf.

Merge classes into one single clip (this will reduce SWF size but might cause some problems if you‘re using -keep or -mx).

Merge classes into one single clip (this will reduce SWF size but might cause some problems if you‘re using -keep or -mx).

width:height:fps:bgcolor: Create a new swf containing only compiled code and using provided header informations. bgcolor is optional and should be 6 digits hexadecimal value.

width:height:fps:bgcolor: Create a new swf containing only compiled code and using provided header informations. bgcolor is optional and should be 6 digits hexadecimal value.

Add type inference for initialized local variables.

Add type inference for initialized local variables.

Main source file to send compiler

Main source file to send compiler

Keep AS2 classes compiled by MCC into the SWF (this could cause some classes to be present two times if also compiled with MTASC).

Keep AS2 classes compiled by MCC into the SWF (this could cause some classes to be present two times if also compiled with MTASC).

Will automaticaly call static function main once all classes are registered.

Will automaticaly call static function main once all classes are registered.

Use Microsoft Visual Studio errors style formating instead of Java style (for file names and line numbers).

Use Microsoft Visual Studio errors style formating instead of Java style (for file names and line numbers).

Use precompiled MX classes (see section on V2 components below).

Use precompiled MX classes (see section on V2 components below).

The SWF file that should be generated, use only in addition to the -swf parameter if you want to generate a separate SWF from the one being loaded

The SWF file that should be generated, use only in addition to the -swf parameter if you want to generate a separate SWF from the one being loaded

Compile all the files contained in specified package - not recursively (eg to compile files in c: lashdemypp do mtasc -cp c: lashde -pack my/app).

Compile all the files contained in specified package - not recursively (eg to compile files in c: lashdemypp do mtasc -cp c: lashde -pack my/app).

Use strict compilation mode which require that all variables are explicitely typed.

Use strict compilation mode which require that all variables are explicitely typed.

Specify the swf that should be generated, OR the input SWF which contains assets.

If this parameter is not set, the MTASCTask will do the following:

  • Iterate over it‘s prerequisites and set the -swf parameter to the output of the first SWFMillTask found
  • If no SWFMillTask instances are in this task prerequisites and the -swf parameter has not been set, it will be set to the same as the -out parameter

Specify the swf that should be generated, OR the input SWF which contains assets.

If this parameter is not set, the MTASCTask will do the following:

  • Iterate over it‘s prerequisites and set the -swf parameter to the output of the first SWFMillTask found
  • If no SWFMillTask instances are in this task prerequisites and the -swf parameter has not been set, it will be set to the same as the -out parameter

Specify a custom trace function. (see Trace Facilities), or no disable all the traces.

Specify a custom trace function. (see Trace Facilities), or no disable all the traces.

Activate verbose mode, printing some additional information about compiling process. This parameter has been aliased as verbose

Activate verbose mode, printing some additional information about compiling process. This parameter has been aliased as verbose

Specify SWF version : 6 to generate Player 6r89 compatible SWF or 8 to access Flash8 features.

Specify SWF version : 6 to generate Player 6r89 compatible SWF or 8 to access Flash8 features.

Adds warnings for import statements that are not used in the file.

Adds warnings for import statements that are not used in the file.

Protected Instance methods

Handle prerequisite libraries by adding them to the source path

Iterate over prerequisites until you find the first SWFMillTask instance, and set self.swf = instance.output so that the skin gets compiled in.

[Validate]