[swfmill] Help grokking SWFML basic (newbie)
Emmet Caulfield
emmet-osflash at caulfield.info
Wed Jun 20 23:25:12 EDT 2007
Hi,
I'm a newbie to all this Flash stuff. Please excuse my ignorance.
First, this is essentially a reverse-engineering question, so from
reading the archives, it seems I must explain what I'm trying to do:
that's made this posting pretty long. That's a lie: I'm just
long-winded :o)
I'm trying to add narration to a presentation created in OpenOffice
Impress, which can export a SWF. I have already used pyvnc2swf to
create screen-casts and it would be really easy to go that
route. However, I'd really rather have a nice compace, resizeable
vector SWF than a raster FLV.
Until last year, I was a programmer and occasional trainer of some
vintage. I returned to college full-time to do a masters. I'm trying
to use the summer to put together a couple of courses that I can
deliver occasionally during the academic year to make some cash. I
figure that being able to offer narrated versions of my presentation
slides, and screencasts of solutions to exercises, would be a good
selling point. I might even get it to the stage (no bad Flash pun
intended) of being able to offer the courses online.
I hope I've convinced you that I'm not trying to rip-off any Flash
stuff or cheat in any online games now :)
In my innocence, I believed that this would be a simple matter of
downloading some kind of whizz-bang graphical tool which would import
the SWF, generate a timeline, allow me to import a soundtrack, move
the slides up and down the timeline, and hey presto.
I can almost hear you laughing. OK, I know better now.
Anyway, swfmill doesn't seem to grok the SWF output of OpenOffice: it
produces no output. So I exported a presentation to PDF and used
pdf2swf from swftools to create a SWF (interestingly, it is smaller
than the one exported by OpenOffice). swfmill processes this just fine
and produces an XML file that I can convert back to SWF (with swfmill
going the other way) and view.
So far, so good. A minor problem is that the first (title) slide zips
past in an instant, while the others are shown for about a second. I'm
hoping a solution to that will fall out of the rest of it.
>From examining the SWFML, I have observed:
* At the beginning, you see many "setup" elements such as
'SetBackgroundColor' and 'DefineFont2'
* The bulk of the XML file is sequences of the following elements
between (not inside) the closed '<ShowFrame/>' tags:
* PlaceObject2
* RemoveObject2
* DefineShape
* DefineShape3
* DefineText
In my file, there is the occasional:
* DefineBitsJPEG3
* DefineBitsLossless2
Each corresponding to an embedded image.
* There are as many 'ShowFrame' elements as there are slides in the
presentation:
$ grep '<ShowFrame/>' slides.xml | wc -l
Now, the way it appears (to me) to work is this:
* There is one cumulative invisible stack from which things are
added and removed for each slide. From reading online stuff, it
appears to be called the "stage".
* The Define{Shape3,Text,Bits{JPEG3,Lossless2}} elements are
declarations that define individual components of each slide, such
as a run of text or a picture, and associate an objectID with it.
* PlaceObject2 places an object, identified by objectID, on the
stage.
* RemoveObject2 removes an object, identified by objectID, from the
stage (presumably placed there before the last <ShowFrame/>)
* Each <ShowFrame/> element renders the current contents of the
stage for viewing (opening the curtains, perhaps?)
I surmised that I should be able to re-order the elements to put all
the Define* elements at the beginning, then have only <PlaceObject2/>
and <RemoveObject2/> elements between the <ShowFrame/>s. I implemented
a simple XSL-T to do this, generated the SWF, and it works as
expected.
In any case, it appears that each slide is not an "addressable" object
in its own right that can be shown or hidden (under ActionScript
control?).
Is there some way that I can put the blocks (currently between
<ShowFrame/>s) of <PlaceObject2/> and <RemoveObject2/> tags inside
some other element to make them identifiable in whatever sense I need
them to be to show/hide them via ActionScript?
Alternatively, could I achieve the same thing, but eliminate the
<RemoveObject2/> tags and, instead, put in whatever sequence of
<PlaceObject2/>s would constitute the background (not sure how I would
identify them yet, but that's a different problem) after clearing the
stage in some way? Is there a stage-clearing command that would help?
There is an <UnknownTag id="0x309"/>. Is this going to bite me?
Finally, am I barking up the wrong tree altogether?
Getting to grips with all this stuff is something of a challenge. If
you can make any other suggestions that might save me some headaches,
please do. I haven't even begun to think about how I might start
controlling the whole thing from ActionScript.
Thanks for reading this far! Who knows, if I succeed, it might turn
into a useful contribution to the body of Open Source Flash software.
Thanks again,
Emmet.
More information about the swfmill
mailing list