# What is going wrong when I save an animation as a SWF-file?

The first I am trying to export animations from Mathematica to a file and then to LaTeX. Don't assume I know anything about what I'm doing.

The following definitions defines the still image of a single frame. It is a stick of length $k$ that has two pivot points: one sliding along $x$-axis, $\{\cos u,0\}$, and the other, along the $y$-axis. $\{0,\sin u\}$, so the distance between the two pivots is always equal to $1$ irrespective of the value of the parameter $u$. One end of the stick is at the $y$-axis pivot, and the other is determined by the length of the stick. That other endpoint draws an ellipse, as $u$ increases from $0$ to $2\pi$.

tikku[u_, k_] :=
Show[{ParametricPlot[{k Cos[x], (1 - k) Sin[x]}, {x, 0, u}],
Graphics[{Line[{{k Cos[u] + 0.05 Sin[u], (1 - k) Sin[u] +
0.05 Cos[u]}, {0.05 Sin[u],
Sin[u] + 0.05 Cos[u]}, {-0.05 Sin[u],
Sin[u] - 0.05 Cos[u]}, {k Cos[u] -
0.05 Sin[u], (1 - k) Sin[u] - 0.05 Cos[u]}, {k Cos[u] +
0.05 Sin[u], (1 - k) Sin[u] + 0.05 Cos[u]}}]}],
Graphics[{PointSize[0.02], {Point[{Cos[u], 0}],
Point[{0, Sin[u]}]}}]}, PlotRange -> {{-2.2, 2.2}, {-1.2, 1.2}},
AspectRatio -> Automatic, AxesOrigin -> {0, 0}, Axes -> True]


Then I create an animation with

movie = Animate[tikku[u, 1.8], {u, 0, 2 Pi}, Alignment -> Center]


That is displayed as expected. But when I export that file with the command

Export["Analyysi I/2013/ellipsi.swf", movie]


and open the resulting .swf file with Adobe Reader I get the following error message (my translation from Finnish): "Adobe Reader couldn't open the file "ellipsi.swf", because it is of an unsupported type...."

I can open the .swf-file in IE. If I export the animation as an .avi-file instead, then I can also view it in Windows Media Player. However, something seems to have gone wrong while exporting, because at the beginning (and also at the end) a frame with Mathematica code is shown instead of the first frame of the animation.

Questions:

1. What should I do to make it viewable in Adobe Reader? (I just installed flashplayer, but that didn't help) This is kinda crucial for including the animation to a slide set produced by LaTeX.
2. What should I do to get rid of that extraneous first frame?
• I didn't think Adobe Reader could open Flash files... Are you sure that what you want to do is possible? Nov 25 '13 at 16:11
• @cormullion: No, I'm not sure. But embedding the resulting .swf to a .pdf- document produced by LaTeX should be possible according to the documentation of a package called media9. My attempts to do that have failed, and I felt that something might be wrong with the .swf-file. It is quite possible that I am wrong. Nov 25 '13 at 17:08
• To see why you get that Mathematica code, try calling your function as tikku[0.0,1.8] and you'll get error messages. I actually got a much better animation using movie2=Table[tikku[u,1.8],{u,0.01,2.0 Pi,Pi/32.0}];Export["test2.swf",movie2]; That answers your question 2), but about question 1) I'm not sure. To narrow down the problem, you should download an SWF file not created by Mathematica from the web and try to embed it in a pdf. If that works and plays properly, then we can try to figure out what is different about Mathematica-generated SWF files. Nov 25 '13 at 17:28
• After a bit of googling I learn (to my horror:)) that it is possible to embed SWF inside a PDF and then view the PDF in Adobe reader. But there are all kinds of issues with security and then I stopped reading so this is where I must bow out of the question... Good luck! Nov 25 '13 at 17:36
• Thanks, @Jason. <insert blush emoticon> That was silly of me. I added the ParametricPlot later, and didn't test it. Of course, in Mathematica the error message flashes out so fast, but I keep seeing the errorneous frame in animation. Nov 25 '13 at 18:06