Class: FlashTool::FlashCombine

Inherits:
Flash
  • Object
show all
Defined in:
lib/flash_tool/flash_combine.rb

Overview

This class work with tool swfcombine it is basic www.swftools.org/swfcombine.html You can use every opticons for this command. For adding master and slave swf files you must use methods master and slave If you trying to use options

Instance Attribute Summary

Attributes inherited from Flash

#args, #info, #input, #output_path

Instance Method Summary collapse

Methods inherited from Flash

#method_missing

Constructor Details

#initialize {|_self| ... } ⇒ FlashCombine

Take two or more SWF files, and combine them into a new SWF file. Can be used with or without master swf file

Use

combinated_file = FlashTool::FlashCombine.new
combinated_file.master("master.swf")
combinated_file.slave("viewport","slave.swf") #viewport is name of frame where can be placed slave
combinated_file.rate(24)
combinated_file.save("merged.swf")

cominated_file = FlashTool::FlashCombine.new do |f|
 f.master("master.swf")
 f.slave("viewport","slave.swf")
 f.output("merged.swf")
 f.save
end

Yields:

  • (_self)

Yield Parameters:



32
33
34
35
36
37
# File 'lib/flash_tool/flash_combine.rb', line 32

def initialize(&block)
  @args = []
  @slaves = []
  @command = "swfcombine"
  yield self if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FlashTool::Flash

Instance Method Details

#master(file) ⇒ Object

With this method you will set master swf file for combining

Can be only one master file

Raise FlashToolError

Raises:



46
47
48
49
# File 'lib/flash_tool/flash_combine.rb', line 46

def master(file)
  raise(FlashToolError, "Can be only one master swf file" ) if @master
  @master = file
end

#save(output_path = nil) ⇒ Object

Method save generate and run swfcombine command and generates file Outputh path must be setted here or with method outputh before

Raise error if output_path is not set.

Raises:



66
67
68
69
70
71
72
# File 'lib/flash_tool/flash_combine.rb', line 66

def save(output_path=nil)
  raise FlashToolError, "No output file name " if !@output_path and !output_path
  to_output_path(output_path)
  combiner
  run_command(@command,*@args)
  @info = FlashTool.flash_info(@output_path)
end

#slave(name, file) ⇒ Object

With this method you will set slave swf file for combining

Can be only one master file



56
57
58
# File 'lib/flash_tool/flash_combine.rb', line 56

def slave(name, file)
  @slaves += ["#{name}=#{file}"]
end