#!/usr/bin/env ruby
#
# drag.rb -- IKEGAMI Daisuke
#
# $Log$

require 'ming/ming'
include Ming

use_SWFVersion(4)

s = SWFShape.new
s.set_right_fill(s.add_fill(0xff, 0, 0))
s.move_pen_to(-25, -25)
s.draw_line(50, 0)
s.draw_line(0, 50)
s.draw_line(-50, 0)
s.draw_line(0, -50)

b = SWFButton.new
b.add_shape(s, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER)

b.add_action(SWFAction.new("startDrag('/test',0);"), SWFBUTTON_MOUSEDOWN)
b.add_action(SWFAction.new("stopDrag();"), SWFBUTTON_MOUSEUP | SWFBUTTON_MOUSEUPOUTSIDE)

p = SWFSprite.new
p.add(b)
p.next_frame

m = SWFMovie.new
m.set_dimension(320, 240)

i = m.add(p)
i.set_name('test')
i.move_to(160, 120)

m.save('drag.swf')
