JSwiff 是一款開源的,基于Java的操作Macromedia Flash file 的框架,可以創(chuàng)建,和操作Flash文件。JSwiff 還提供了JSwiff Investigator,可以直接分析現(xiàn)有的SWF文件的結(jié)構(gòu),得到Tag層次的信息..
其他不多說,喜歡的人自己可以到該網(wǎng)站去了解,下面我就拿出一個例子來。呵~~從官方那邊修改過來的,我就不多做解釋了(呵~人家說得很明白啦,雖然有點煩瑣)
Java的Flash類庫(JSwiff)用法
import java.io.FileOutputStream;
import java.io.IOException;
import com.jswiff.SWFWriter;
import com.jswiff.SWFDocument;
import com.jswiff.swfrecords.Rect;
import com.jswiff.swfrecords.RGBA;
import com.jswiff.swfrecords.Matrix;
import com.jswiff.swfrecords.tags.DefineFont2;
import com.jswiff.swfrecords.tags.DefineEditText;
import com.jswiff.swfrecords.tags.PlaceObject2;
import com.jswiff.swfrecords.tags.ShowFrame;
public class CreateSwf
{
public static void main(String[] args)
{
String fileName = "test.swf";
SWFDocument document = new SWFDocument();
// first we define a font for the text
// get a character ID for the font
int fontId = document.getNewCharacterId();
// use a standard font (e.g. Arial), we don't want to define shapes for each glyph
DefineFont2 defineFont2 = new DefineFont2(fontId, "Arial", null, null);
document.addTag(defineFont2);
// get a character ID for our text
int textId = document.getNewCharacterId();
// dynamic text is a good way to go, we use DefineEditText for this
// we don't care about bounds and variables
DefineEditText defineEditText = new DefineEditText(
textId, new Rect(0, 0, 0, 0), null);
// we have set the text bounds to a zero rectangle;
// to see the whole text, we set the autosize flag
defineEditText.setAutoSize(true);
// assign the font defined above to the text, set font size to 24 px (in twips!)
defineEditText.setFont(fontId, 20 * 24);
// set text color to red
defineEditText.setTextColor(new RGBA(255, 0, 0, 255));
// don't let viewers mess around with our text
defineEditText.setReadOnly(true);
// finally set the text
defineEditText.setInitialText("棄天笑(soda) test!");
document.addTag(defineEditText);
// place our text at depth 1
PlaceObject2 placeObject2 = new PlaceObject2(1);
placeObject2.setCharacterId(textId);
// place text at position (45; 10) (in twips!)
placeObject2.setMatrix(new Matrix(20 * 45, 20 * 10));
document.addTag(placeObject2); // place text
document.addTag(new ShowFrame()); // show frame
try
{
writeDocument(document, fileName);
}
catch (IOException e)
{
System.out.println("An error occured while writing " + fileName + ":");
e.printStackTrace();
}
}
private static void writeDocument(SWFDocument document, String fileName)
throws IOException
{
SWFWriter writer = new SWFWriter(document, new FileOutputStream(fileName));
writer.write();
}
}
- PC官方版
- 安卓官方手機版
- IOS官方手機版














oelove婚戀交友系統(tǒng)v8.1 十周年版
sqltoy-orm框架v4.18.13最新版
flutter聊天源碼開源完整版
最新版抖商精靈源碼4.1暖場升級版
完整版經(jīng)典C#WinForm實例源碼共200個
android5使用poi讀取excel源代碼
香程互贊寶源碼免授權(quán)版
百度小程序轉(zhuǎn)微信小程序1.0 最新免費版
BCM文件轉(zhuǎn)換工具(BCM源碼格式化)2.7.2 簡體中文版
易語言資源網(wǎng)源碼下載工具1.0 中文免費版
縮狗圖床源碼免費版
24個c++游戲源碼完整版
嵌入式圖像處理C語言源碼免費下載
騰訊AI語音合成源碼最新免費版
DSShop單用戶B2C開源PHP商城系統(tǒng)TP框架1.6 最新版
易之源(最好的源碼解析工具)v1.0 免費版
妖氣山視頻管理系統(tǒng)源碼免費下載
魔性機器人網(wǎng)頁代碼免費下載
凈網(wǎng)小助手源碼2.2.1 最新完整版
易語言源碼誤刪恢復(fù)器1.0 官方版
微擎微贊一物一碼抽獎模塊源碼最新完整版
微信小程序模板源碼50個實用程序
Android poi 操作doc excel pdf
Amoli私有云4.2.2 2019.08.08 最新版
LaySNS輕社區(qū)系統(tǒng)2.55 最新版
可可網(wǎng)絡(luò)驗證系統(tǒng)9.5 官方版
源碼編輯器軟件3.4.13 電腦版
Activiti(開源bpm軟件)6.0.0 官方最新版
悟空crm系統(tǒng)源碼9.0_20191202 官方最新版
帝國網(wǎng)站管理系統(tǒng)7.5.0 官網(wǎng)正式版





Android Studio 源碼2.4 免費下載
浮夢QQ工具箱易語言源碼1.0免費版
易語言電腦開機自動拍照發(fā)指定郵箱源碼5.5
ECSHOP家居網(wǎng)上商城模塊源碼2.7.2免費暢享版
CF狄克改槍源碼免費打包下載
仿騰訊新聞門戶網(wǎng)站管理系統(tǒng)模板源碼v2.0 正
mpycQQ機器人插件源碼2016 最新版
似水年華同學(xué)錄破解版2.2 正式版php源碼
UCKeFu客戶支持服務(wù)平臺源碼1.2.0 免費下載