Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
module FlexCompiler
COMPILER = "/Applications/Adobe\\ Flex\\ Builder\\ 3/sdks/3.2.0/bin/mxmlc"
FRAMEWORK_PARAM = "-runtime-shared-library-path=/Applications/Adobe\\ Flex\\ Builder\\ 3/sdks/3.2.0/frameworks/libs/framework.swc,framework_3.2.0.3958.swz,,framework_3.2.0.3958.swf"
COMPONENTS_PARAM = "-runtime-shared-library-path=vendor/flex/components/bin/components.swc,components.swf"
DEFAULT_FLAGS = "--warnings=true --strict=true --debug=false"
def self.compile_swf(project)
puts "compiling #{project}"
project_path = "vendor/flex/#{project}/src/#{project}"
compile_cmd = "#{COMPILER} #{DEFAULT_FLAGS} #{FRAMEWORK_PARAM} #{COMPONENTS_PARAM} -file-specs #{project_path}.mxml"
#puts compile_cmd
`#{compile_cmd}`
`mv #{project_path}.swf public/flash/#{project}.swf`
end
def self.optimize_swc(library="components")
`unzip vendor/flex/#{library}/bin/#{library}.swc -d vendor/flex/#{library}/bin/unzip`
`optimizer -keep-as3-metadata="Bindable,Managed,ChangeEvent,NonCommittingChangeEvent,Transient" -input=vendor/flex/#{library}/bin/unzip/library.swf -output=public/flash/#{library}.swf`
`rm -rf vendor/flex/#{library}/bin/unzip`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment