module FN::SWF::Node::Text

Constants

SPACE

Public Instance Methods

escaped_text() click to toggle source
# File lib/fn/swf/node/text.rb, line 26
def escaped_text
  text.gsub("\\", "\\\\").gsub("\"", "\\\"").gsub(SPACE, " ")
end
text() click to toggle source
# File lib/fn/swf/node/text.rb, line 17
def text
  (child && child.content).to_s
end
text=(s) click to toggle source
# File lib/fn/swf/node/text.rb, line 21
def text=(s)
  self.children.map{|c| c.remove! }
  self << XML::Node.new_cdata(s)
end
visit(struct, debug = false) click to toggle source
# File lib/fn/swf/node/text.rb, line 30
def visit(struct, debug = false)
  has_no_children
  name = "#{self[:text]}_#{self[:index]}"
  x = self[:x]
  y = self[:y]
  w = self[:width]
  h = self[:height].to_i + 20 # Fudge
   
  struct.<< ".action:" do
                  struct << "this.createTextField('#{name}', #{$depth+=1}, #{x}, #{y}, #{w}, #{h});"
                struct << "id = this['#{name}'];"
                struct << "id.html=true;"
                struct << "id.multiline=true;"
                struct << "id.wordWrap=true;"
                struct << "id.htmlText = \"#{escaped_text}\";"
                struct << "id.selectable = false;"
                end
end