# $Id: bgshape.rb,v 1.1.1.1 2003/10/29 01:20:42 knok Exp $

require 'color'
require 'ming/ming'
include Ming

class BgShape
  attr_reader :shape, :fill, :color, :dim
  def initialize(color, dim)
    @color = color.dup
    @dim = dim.dup
    @shape = SWFShape.new
    @fill = @shape.add_fill(color.red, color.green, color.blue)
    @shape.set_right_fill(@fill)
    @shape.draw_line(dim[0], 0)
    @shape.draw_line(0, dim[1])
    @shape.draw_line(-dim[0], 0)
    @shape.draw_line(0, -dim[1])
    @button = nil
  end
  def setNext(uri)
    @button = SWFButton.new
    @button.add_shape(@shape, SWFBUTTON_HIT)
    @nextaction = SWFAction.new("getURL('#{uri}', '_level0');")
    @button.set_action(@nextaction)
    return @button
  end
  def setResume()
    @button = SWFButton.new
    @button.add_shape(@shape, SWFBUTTON_HIT)
    @nextaction = SWFAction.new("play();")
    @button.set_action(@nextaction)
    return @button
  end
end
