Has anyone successfully used the Transform SWF for Java library from [Flagstone Software][1]
[1]: http://www.flagstonesoftware.com/transform/index.html to edit an existing swf file. Mainly what I want to accomplish is load a swf file and replace images or texts dynamically. Thank you.
I know it is a little bit late, but google searchers will still land here :-) This code will color the first text span of all text elements to red.
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.zip.DataFormatException;
import com.flagstone.transform.Movie;
import com.flagstone.transform.MovieTag;
import com.flagstone.transform.datatype.Color;
import com.flagstone.transform.text.DefineText;
public class Flash {
public static void main(String args[]) throws MalformedURLException, DataFormatException, IOException {
Movie m = new Movie();
m.decodeFromFile(new File("C:\\tmp\\Movie.swf"));
for (MovieTag mt : m.getObjects()) {
System.out.println(mt.getClass() + " " + mt.toString());
if (mt instanceof DefineText) {
((DefineText) mt).getSpans().get(0).setColor(new Color(255, 0, 0));
}
}
m.encodeToFile(new File("C:\\tmp\\foo.swf"));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With