JavaSWFを使ってSWFファイルを生成してみました。
JavaSWFは、名前のとおりJavaからSWFファイルを読み書きできるライブラリです。
http://sourceforge.net/projects/javaswf/
ソースはこんな感じ
import com.anotherbigidea.flash.movie.*; import com.anotherbigidea.flash.structs.*; import java.io.IOException; public class NewClass { public static void main(String[] args) throws IOException{ //枠線 Shape sh = new Shape(); sh.defineLineStyle(3, new Color(0, 255, 0)); sh.setLineStyle(1); sh.move(10, 3); sh.line(390, 3); sh.curve(397, 10, 397, 3); sh.line(397, 297); //家っぽいの Shape s = new Shape(); s.defineLineStyle(5, new Color(0, 0, 255)); Color[] colors = { new Color(212, 212, 255), new Color(255, 0, 0), new Color(0, 0, 32)}; int[] ratios = {0, 128, 255}; s.defineFillStyle(colors, ratios, new Transform(), true); //s.defineFillStyle(new Color(128, 128, 255)); s.setLeftFillStyle(1); s.setLineStyle(1); s.move(50, 3); s.line(97, 50); s.line(50, 97); s.curve(3, 50, 3, 97); s.curve(50, 3, 3, 3); //アニメーション MovieClip mc = new MovieClip(); Frame mcf = mc.appendFrame(); Instance ins = mcf.placeSymbol(s, new Transform(30, 30), new AlphaTransform(1., 1., 1., 1.)); for(int i = 0; i < 100; ++i){ Frame fi = mc.appendFrame(); fi.alter(ins, new Transform(Math.PI * 2 * i / 100, 30 + i, 30 + i * 2), new AlphaTransform(1., 1., 1., 100 / 100.)); } //ファイル生成 Movie m = new Movie(); m.setWidth(400); m.setHeight(300); m.setBackColor(new AlphaColor(255, 255, 255, 0)); Frame f = m.appendFrame(); f.placeSymbol(sh, 0, 0); f.placeSymbol(mc, 10, 10); m.write("C:\\Users\\naoki\\Desktop\\first.swf"); } }
生成したファイルはこんな感じ。
http://www.geocities.jp/nbdemo/first.swf
※直リンクは怒られるっぽいので、アドレスバーでenter押したりしてください