Reputation: 9545
I was wondering if there is any Python library out there which would allow me to generate Flash files (a simple slide show of a bunch of images).
I tried installing Ming but was running into some problems, so was wondering if there is any other library out there with better documentation.
Upvotes: 5
Views: 799
Reputation: 2220
For this you can do a workaround unless you find a python library for it.
You can use Flex SDK and the command line compiler (found in /bin
).
Basically, setup the flash actionscript code with python, then compile it to an swf.
If you have images in a folder, then
[Embed(source="IMAGE-NAME")]
var Image:Class;
var image:* = new Image();
addChild(image);
embeds an image and adds it to the stage.
So, if you have more images, put it in a loop in python, when writing the actionscript file, like:
[Embed(source="IMAGE-NAME-1")]
var Image1:Class;
[Embed(source="IMAGE-NAME-2")]
var Image2:Class;
var image1:* = new Image1();
addChild(image1);
var image2:* = new Image2();
addChild(image2);
etc.
Hope this gives some idea. After this, you can write a timer or an interval for showing the actual image.
Something like
var totalFrames:int = ...;
var actualFrame:int = 0;
var lastImage:* = null;
flash.utils.setInterval(nextframe, 1000/30);
function nextframe():void
{
//hide last visible image
if(lastImage != null) lastImage.visible = false;
//show next image
lastImage = this["image" + actualFrame];
lastImage.visible = true;
actualFrame = (actualFrame + 1) % totalFrames;
}
Hide all images when adding to the stage (image#.visible = false;
).
And so, with python you generate the actionscript, then run the command line compiler.
Hope this gives some idea.
Upvotes: 3