Sha256: b30faccd8acef9ffbd37ab64fc476f65f9255690bac98d068ec2cb4cb4732432

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

require File.dirname(__FILE__) + "/../../node/base"
module FN
  module SWF
    module Node
      def HotSpot(page)
        x, y, x2, y2 = page[:hotspot].gsub(/\s/, '').split(",").map{|s| s.to_i}
        w = x2 - x
        h = y2 - y
        FN::Node::Base("hot_spot", :x => x, :y => y, :w => w, :h => h, :n => page[:number]).extend(HotSpot)
      end
      
      module HotSpot 
        include FN::Node::Base
      
        def visit(struct)
          has_no_children
          
          x = self[:x]
          y = self[:y]
          w = self[:w]
          h = self[:h]
          n = self[:n]
          
      	  struct << ".box btni#{n} width=#{w} height=#{h} color=red fill=white"

      	  struct.<< ".button btn#{n}" do
        	  struct.<< ".show btni#{n} as=area", :no_end_tag do
        	    struct.<< ".on_release:" do
        	      struct << "gotoAndStop(#{n});"
      	      end
            end
          end
          
          struct.<< ".action:" do
            struct << "_root.attachMovie('btn#{n}', 'btni#{n}', #{$depth+=1}, {_x:#{x}, _y:#{y}});"
          	struct << "_root['btni#{n}']._x = #{x};"
          	struct << "_root['btni#{n}']._y = #{y};"
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fn_document-0.9.6 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.4 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.3 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.2 lib/fn/swf/node/hot_spot.rb