Permalink
Browse files

add support for replacing movie-clips

  • Loading branch information...
aereal
aereal committed Jun 6, 2011
1 parent bd32644 commit f053f86a8ed25844de96de39572de965d408e37a
Showing with 17 additions and 5 deletions.
  1. +9 −5 lib/swaf.rb
  2. +4 −0 lib/swaf/helper.rb
  3. +4 −0 spec/swaf_spec.rb
View
@@ -52,17 +52,21 @@ def replace(params={})
def make_target(key, value)
case key
when Symbol
- SwfRuby::AsVarReplaceTarget.build_by_var_name(@dumper, key.to_s).each {|t|
- t.str = value
- }.first
+ if value.kind_of?(Array) && value.size == 2 # movie-clip
+ SwfRuby::SpriteReplaceTarget.build_list_by_instance_var_names(
+ @dumper, key.to_s => value
+ ).first
+ else
+ SwfRuby::AsVarReplaceTarget.build_by_var_name(@dumper, key.to_s).each {|t|
+ t.str = value
+ }.first
+ end
when Integer
case value.first
when :jpeg
SwfRuby::Jpeg2ReplaceTarget.new(detect(key), value.last)
when :gif, :png
SwfRuby::Lossless2ReplaceTarget(detect(key), value.last)
- when :movie
- # TODO
end
end
end
View
@@ -14,5 +14,9 @@ def png(file)
def gif(file)
[:gif, File.binread(file)]
end
+
+ def movie(file)
+ [:movie, File.binread(file)]
+ end
end
View
@@ -37,6 +37,10 @@
it "replace value of ActionScript's variable with specified value" do
subject.replace(:_itemname => 'fugafuga').swf.should == as_var_replaced_swf
end
+
+ it "replace movie-clips with specified ones" do
+ pending
+ end
end
end

0 comments on commit f053f86

Please sign in to comment.