\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,designv},
    eforms,graphicxsp={showembeds},aebxmp
]{aeb_pro}
\usepackage[use3D]{rmannot}
\usepackage{eforms}

% Alexander Grahn a.grahn@web.de

%\margins{1in}{1in}{.5in}{.5in} % left,right,top, bottom
%\screensize{11in}{8.5in}       % height,width dimensions

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

\def\AcroTeX{Acro\!\TeX}



\definePath{\myPath}{C:/Users/Public/Documents/%
    My TeX Files/tex/latex/aeb/aebpro/rmannot/%
    examples/rm3da}
\definePath{\myRMFiles}{%
    C:/Users/Public/Documents/My TeX Files/%
    tex/latex/aeb/aebpro/rmannot/RMfiles}
\saveNamedPath{myDice}{\myPath/3dmodels/dice.u3d}
\saveNamedPath{turntableJS}{\myPath/js/turntable.js}
\saveNamedPath{AcroAd}{\myRMFiles/Acro_Advertiser.swf}

\newcommand{\cs}[1]{\texttt{\char`\\#1}}

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

\begin{document}
\begin{center}\large\bfseries
RMA and 3D Annotations
\end{center}
Using the 3D feature of \textsf{rmannot}, you can not only embed 3D
models, such as \texttt{dice.u3d}, as distributed with the
\textsf{movie15} package (author, Alexander Grahn), but you can bind SWF
applications to the background, foreground, or to a material.

%--------------

\setRmOptions3D{my3DDice}{%
    3DOptions={%
        3Droo=40,
        3Dlights=CAD,
        3Drender=Solid,
        3Djscript=turntableJS,
%        3Dbg=1 0 0,
        3Dviews=views/dice.vws,
   },%
   3DResources={%
        background={rName=AcroAd}
%        foreground={rName=AcroAd}
   }%
}

% Comment out the background line, and uncomment the foreground line and
% recompile. Try viewing in a window and in fullscreen. You can see that you
% can manipulate the dice through the foreground SWF, swave!

\begin{center}
\rmAnnot[name=my3DDice,toolbar]{.67\textwidth}{2in}{myDice}
\end{center}
The following two button illustrates how to control the view. Two methods
are used, the left button uses the GoTo3DView action, the one uses the
method \texttt{setView()}, available through the 3D JS engine.

\newcommand{\gotoNamedView}[2]{%
\JS{var rm=this.getAnnotRichMedia(this.pageNum,"#1");\r
    rm.activated=true;}\Next{%
    /S/GoTo3DView/TA \RefObjRm{#1}/V (#2)}%
}
\makebox[\linewidth][c]{%
    \pushButton[\CA{Front View}\TU{Uses GoTo3DView action}
        \A{\gotoNamedView{my3DDice}{Front View}}]{frontView1}{}{11bp}\kern1bp
    \pushButton[\CA{Front View}\TU{Uses setView from 3D JS engine}\A{\JS{%
        var rm=this.getAnnotRichMedia(this.pageNum,"my3DDice");\r
        rm.activated=true;\r
        if (rm.subtype=="3D") {\r\t
            var c3d=rm.context3D;\r\t
            c3d.runtime.setView("Front View", true);\r
        }
    }}]{frontView2}{}{11bp}%
}
One significant difference in dealing with RM3D annotations, it that the
annotation is a rich media annotation not a 3D annotation. This is seen in
some of the code of the buttons, where we say, for example,
\begin{verbatim}
    var rm=this.getAnnotRichMedia(this.pageNum,"my3DDice");
\end{verbatim}
that is, we use \texttt{Doc.getAnnotRichMedia} (or \texttt{Doc.getAnnotsRichMedia})
instead of the 3D method of \texttt{Doc.getAnnot3D} (or \texttt{Doc.getAnnots3D}).


\end{document}
