\documentclass{article}
\usepackage{amsmath}
%
% the driver line is not necessary if you
% have aebpro.cfg configured to your driver.
%
\usepackage[%
%    driver=dvips,
    web={nodirectory,pro,tight,usesf},
    eforms,graphicxsp={showembeds}
]{aeb_pro}
\usepackage{rmannot}

\margins{.25in}{.25in}{24pt}{.25in} % left,right,top, bottom
\screensize{5in}{5.5in}             % height, width

\DeclareDocInfo
{
    title=The \texttt{rmannot} Package\texorpdfstring{\\[1ex]}{: } The Scripting Bridge,
    author=D. P. Story,
    university=Acro\negthinspace\TeX.Net,
    email=dpstory@acrotex.net,
    subject={Demo of the rmannot package, SWF movies},
    keywords={Adobe Acrobat, JavaScript, Adobe FLEX 3, ActionScript},
    talksite=\url{http://www.acrotex.net},
    talkdate={July 2008},
    copyrightStatus=True,
    copyrightNotice={Copyright (C) \the\year, D. P. Story},
    copyrightInfoURL=http://www.acrotex.net
}
\talkdateLabel{Published:}

\def\AcroTeX{Acro\!\TeX}

\newcommand{\myRMFiles}{C:/Users/Public/Documents/My TeX Files/tex/latex/aeb/aebpro/rmannot/RMfiles}
\saveNamedPath{horse1}{\myRMFiles/horse1.flv}
\makePoster[hiresbb]{aebmovie_poster}{aebmovie_poster}
\makePoster[hiresbb]{horse1_poster}{horse1_poster}



\parindent=0pt\parskip6pt\pagestyle{empty}


\begin{document}

\maketitle

\previewtrue

When playing a FLV movie or a MP3 music clip, you can use Acrobat
form buttons to control the media clip through the scripting bridge
that connects Acrobat JavaScript to Flash ActionScript. Acrobat uses
two SWF files that play FLV and MP3, these are
\texttt{VideoPlayer.swf} and \texttt{AudioPlayer.swf}.  You can
communicate with these two SWF using the \texttt{callAS} method of
the \texttt{AnnotRichMedia} object, as documented in the
\textsl{JavaScript for Acrobat API Reference} guide.

The \texttt{callAS} method passes function names have been exposed
(to external use) using the \texttt{ExternalInterface.addCallback}
in ActionScript. These exposed methods are
\texttt{multimedia\_play}, \texttt{multimedia\_pause},
\texttt{multimedia\_rewind}, \texttt{multimedia\_seek},
\texttt{multimedia\_nextCuePoint},
\texttt{multimedia\_prevCuePoint}, \texttt{multimedia\_volume}, and \texttt{multimedia\_mute}.

In this demo file, we illustrate the use of
\texttt{multimedia\_play}, \texttt{multimedia\_pause}, and \texttt{multimedia\_rewind}.

Basically, the technique is first to get the AnnotRichMedia object of the target annotation
using either \texttt{Doc.getAnnotsRichMedia()} or \texttt{Doc.getAnnotRichMedia()} methods.
\begin{verbatim}
    var rm = this.getAnnotsRichMedia(this.pageNum)[0];
\end{verbatim}
Here we get the first rich media annotation on the current page.
If we want to play the media, we might do something like this
\begin{verbatim}
    if ( rm ) {
        if (!rm.activated) rm.activated=true;
        rm.callAS("multimedia_play");
    }
\end{verbatim}
If we want to play the media, we might do something like this


\begin{center}
\resizebox{2in}{!}
    {\rmAnnot[poster=aebmovie_poster]{640bp}{480bp}{horse1}}\\[1ex]
    \scriptsize
    \pushButton[\CA{Play}\textSize{5}\A{\JS{%
        var rm = this.getAnnotsRichMedia(this.pageNum)[0];\r
        if ( rm ) {\r\t
            if (!rm.activated) rm.activated=true;\r\t
            rm.callAS("multimedia_play");\r
        }
    }}]{horse1Play}{}{9bp}%
    \pushButton[\CA{Pause}\textSize{5}\A{\JS{%
        var rm = this.getAnnotsRichMedia(this.pageNum)[0];\r
        if ( rm ) {\r\t
            if (!rm.activated) rm.activated=true;\r\t
            rm.callAS("multimedia_pause");\r
        }
    }}]{horse1Pause}{}{9bp}%
    \pushButton[\CA{Rewind}\textSize{5}\A{\JS{%
        var rm = this.getAnnotsRichMedia(this.pageNum)[0];\r
        if ( rm ) {\r\t
            if (!rm.activated) rm.activated=true;\r\t
            rm.callAS("multimedia_rewind");\r
        }
    }}]{horse1Rewind}{}{9bp}
\end{center}
The above video has play, pause, and rewind buttons that use the
scripting bridge to communicate with the underlying
\texttt{VideoPlayer.swf}.\footnote{Video downloaded from
youtube.com.}
 These techniques are for FLV and MP3 files only.
A SWF file would not obey \texttt{multimedia\_play} method, for example.

\end{document}
