Ming/Ruby

Ming/Ruby is a library for Ruby to generate Macromedia Flash (SWF). It is a wrapper around Ming (a SWF output library).

The original Ming has a Ruby extension based on SWIG. However it seems not work well (for Ming version 0.2a). Then, I decided to write another wrapper. Though SWIG is simple to use, unfortunately I don't know about SWIG very much, and this Ming/Ruby library is not based on SWIG.

A hello world example

require 'ming/ming'
include Ming

@movie = SWFMovie.new
@movie.set_dimension(50, 50)
@font = SWFBrowserFont.new('_serif')
@text = SWFTextField.new

@text.set_font(@font)
@text.add_string('Hello, world')

@info = @movie.add(@text)
9.times { |j|
  @info.move_to(0, j * 5)
  @movie.next_frame
}

@movie.add(SWFAction.new('stop();'))
@movie.save('hello.swf')

SWF: Hello sample.

[source/ SWF file]

Applications

mingplot
a tool to generate a flash-based chart.

Licence

This library is a free with ABSOLUTELY NO WARRANTY under the terms of the GNU Lesser General Public License.

Old links


IKEGAMI Daisuke <ikegami@madscientist.jp>