Interactivity

Standard Actions

HOOPS Publish supports the connection of standard actions to buttons or links within the PDF document.

Standard actions are predefined and avoid the developper to write some Javascript code to control actions. Standard actions are of following types :

Playing a U3D animation

T he U3DWithAnimation sample shows how to play a pre-defined animation stored within a U3D file.

Note that the first seven seconds of the animation stored in the U3D file don’t do anything so the animation is set to start at 8 seconds. The start animation button launches the animation for the 3D Annotation context. The pause and the resume buttons stop and play this animation.:

// button start
iRet = A3DPDFPageGetField(pPage, "Button1", &pButStart);
iRet = A3DPDFPageFieldButtonSetLabel(pPage, "Button1", "Play");
if (pButStart)
{
iRet = A3DPDFButtonSetLabel(pButStart, "Start");
A3DPDFAction* pAction = NULL;
sActionData.m_p3DAnnot = p3DAnnot;
sActionData.m_bIsNativeAnimation = TRUE;
// Note: with the car.u3d sample, the animation really starts at 8 secs.
sActionData.m_dStartTime = 8.0;
sActionData.m_dEndTime = -1.0;
iRet = A3DPDFActionStartAnimationCreate(&sActionData, &pAction);
iRet = A3DPDFButtonAddAction(pButStart, pAction);
}
// button pause
A3DPDFButton* pButPause = NULL;
A3DPDFPageGetField(pPage, "Button2", &pButPause);
if (pButPause)
{
iRet = A3DPDFButtonSetLabel(pButPause, "Pause");
A3DPDFAction* pAction = NULL;
sActionData.m_p3DAnnot = p3DAnnot;
iRet = A3DPDFActionPauseAnimationCreate(&sActionData, &pAction);
iRet = A3DPDFButtonAddAction(pButPause, pAction);
}
// button Resume
A3DPDFButton* pButResume = NULL;
A3DPDFPageGetField(pPage, "Button3", &pButResume);
if (pButResume)
{
iRet = A3DPDFButtonSetLabel(pButResume, "Resume");
A3DPDFAction* pAction = NULL;
sActionData.m_p3DAnnot = p3DAnnot;
iRet = A3DPDFActionResumeAnimationCreate(&sActionData, &pAction);
iRet = A3DPDFButtonAddAction(pButResume, pAction);
}
top_level:1 prog_guide:2