Jswiff, Java framework for generating flash files __js
Source: Internet
Author: User
Jswiff is an open source, Java-based Operation Macromedia Flash file framework that can create, and manipulate flash files.
Jswiff also provides Jswiff investigator, which can directly analyze the structure of existing SWF files and get information at the tag level.
Jswiff is completely open source, based on dual license (gpl/commercial).
The official website is http://www.jswiff.com/
Oh ~ See this news excited, according to information generated SWF, unimaginable, RIA, haha (although the current software is not very perfect, even if there is flex can be generated according to XML SWF)
Others do not say, like the people themselves can go to the website to understand, below I take out an example to come. Ah ~ ~ from the official side of the revised over, I do not have to do more explanation (ah ~ They speak very clearly, although a bit cumbersome)
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 ();
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), and we don ' t want to define the 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 and 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 the whole text, we set the AutoSize flag
Defineedittext.setautosize (TRUE);
Assign the font defined above to the text, set font size to-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 and our text
Defineedittext.setreadonly (TRUE);
Finally set the text
Defineedittext.setinitialtext ("Abandon the day Laugh (soda) test!");
Document.addtag (Defineedittext);
Place we text at depth 1
PlaceObject2 placeObject2 = new PlaceObject2 (1);
Placeobject2.setcharacterid (Textid);
Place text at position (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 ();
}
}
Ah ~ Remember to configure the Jswiff-8.0-beta-2.jar into the environment variable OH. Then compile and run, it will produce a test.swf file. Haha, run quickly
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service