Sha256: 34cec680239d2b73f88acede10fc64066e30f2220199f2bcbf79ed27350ab812

Contents?: true

Size: 1.21 KB

Versions: 12

Compression:

Stored size: 1.21 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, debug = false)
          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

12 entries across 12 versions & 1 rubygems

Version Path
fn_document-0.9.18 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.17 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.16 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.15 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.14 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.13 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.12 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.11 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.10 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.9 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.8 lib/fn/swf/node/hot_spot.rb
fn_document-0.9.7 lib/fn/swf/node/hot_spot.rb