Vinova tuyển lập trình viên Mobile & Web ở Hà Nội, lương $300-1000

Article: Xuất bản hàng loạt tập tin .fla 1054

ngocdaothanh.myopenid.com 172
Updated over 3 years ago

Khi dự án liên quan đến Flash có vài chục tập tin .fla, mà sếp lại yêu cầu xuất bản (publish) chúng ra tập tin .swf thì thật là phiền vì ta phải mở từng tập tin, click menu Files -> Publish... rất mất nhiều thời gian. Rất may là mặc dù Adobe Flash không cho phép dùng command line, nhưng lại có cái gọi là JSFL.

Nguyên lí

Tạo tập tin publish.jsfl có nội dung sau:

var doc = fl.openDocument("file:///D:/tmp/tmp.fla");
doc.exportSWF("file:///D:/tmp/tmp.swf", true);
fl.closeDocument(doc, false);

Dùng Adobe Flash mở tập tin này, tmp.fla sẽ được xuất bản thành tmp.swf.

Ứng dụng

Để xuất bản hàng loạt, ta tạo chương trình Ruby sau:

FLASH = 'C:/Program Files/Adobe/Adobe Flash CS3/Flash.exe'

unless File.exist?(FLASH)
puts "Please change FLASH constant in publish.rb"
abort
end

if ARGV.size > 1
puts 'Usage: publish.rb [path to a .fla file]'
abort
end

flas = []
if ARGV.size == 1
flas = ARGV
unless File.exist?(flas[0])
puts "#{flas[0]} does not exist"
abort
end
else
flas = Dir.glob('**/*.fla')
end

# Convert to absolute path
dir = File.dirname(__FILE__)
flas = flas.map { |f| File.expand_path(f) }

# Build .jsfl
jsfl =<

Nhanh nhỉ, sếp gật gù, hôm nay cho anh em về sớm, nhớ gọi điện đặt bàn trước nhé.

Comments

phananhvu.myopenid.com 125
over 3 years ago

Hình như JSFL giống kiểu "mếch phai" của "Xi" nhỉ. {#emotions_dlg.sealed}

You must login to be able to comment

Uploaded files

No file uploaded yet

You must login to be able to upload

Nhà tài trợ:

Mọi người đều tự do viết bài, sửa bài của người khác, và bình luận ở trang web này. Bạn muốn chủ động tạo bài mới để chia sẻ kinh nghiệm với mọi người? Xin click link ở dưới.

Create new content