Skip to main content
Brian_Raila
Inspiring
February 16, 2020
質問

Button Action - WAIT a set time interval/delay/idle between two, separate, Multimedia Operations

  • February 16, 2020
  • 返信数 1.
  • 1017 ビュー

 

Assume I'm quite adept with Acrobat Pro, knowing Multimedia Operations especially well.

 

Assume that, though I've utilized limited JavaScript successfully, I'm far from expert, there.

 

Objective (upon a singular Button event):

 

Button Properties => Select Trigger => Mouse Up => Select Action => Multimedia Operation [Play 'Clip1'] -- then Add:

 

Button Properties => Select Trigger => Mouse Up => Select Action => Run a JavaScript -- which Opens:

 

     -- JavaScript Editor --

Java code says... [e.g. SetTimeout, or Delay, or Idle, or Whatever.is.Appropriate -- for n milliseconds] // next Action is postponed for n milliseconds, though 'Clip1' continues to play, uninterrupted, as is also the case for all other temporal processes within the document. -- then Add:

 

Button Properties => Select Trigger => Mouse Up => Select Action => Multimedia Operation [Play 'Clip2']

 

End Result Summary:

Button event occurs . Clip1 rolls. After n milliseconds, Clip 2 rolls.

 

 

このトピックへの返信は締め切られました。

返信数 1

Brian_Raila
Brian_Raila作成者
Inspiring
February 17, 2020

 

I'm making progress!

 

It was suggested that, "You can't delay non-JS commands using a script," so, "find a JS command to play the clip," and, "it can be a bit tricky since the RMA has to be activated first."

 

Well, I have done so, though wholly uncertain that I've the best approach.  What I'm doing is, upon a Button Event, Run a JavaScript.  (I'm not finding a means to upload my document as a sample –– speak up, if I can do that), but here is the script:

// on document page 1, activate RMA[0], per (try67)
var rm = this.getAnnotsRichMedia(0)[0];
// Play RMA[0]
if ( rm ) {
if (!rm.activated) rm.activated=true; rm.callAS("multimedia_play");
}
// Wait n milliseconds <== NEED IDLE OPERATION HERE
// on document page 1, activate RMA[1]
// var rm = this.getAnnotsRichMedia(0)[1]; ??
// How to PLAY RMA[1] ??

 

Result:

Hit the button.  Clip1 <RMA[0]> rolls as it should.  This is most encouraging.

 

What remains:

a.)  Need the Idle/Wait/Hold/Delay operation before proceeding to Clip2 <RMA[1]>.

b.). Need to understand how callAS is directed to RMA[1], to initiate its Play.

 

Brian_Raila
Brian_Raila作成者
Inspiring
February 19, 2020

 

Almost there!

 

Here is the script:

var aRM = this.getAnnotsRichMedia(0); // var used to ID any Clip on first page (PDF document page# minus 1)
//
var rm = aRM[0]; // get rich media annot for Clip1 [RMA index# minus 1]
//
if ( !rm.activated ) rm.activated=true; // activate the Clip-annot 
rm.callAS("multimedia_play"); // play Clip1
//
// WAIT N MILLISECONDS BEFORE PROCEEDING, THEN ==>
//
var rm = aRM[1]; // get rich media annot for Clip2 [RMA index# minus 1]
//
if ( !rm.activated ) rm.activated=true; // activate the Clip-annot 
rm.callAS("multimedia_play"); // play Clip2

 

Result:

Hit the button.  Clip1–RMA[0] rolls.  Clip2–RMA[1] rolls.

 

All that remains:

Need the Idle/Wait/Hold/Delay/Stall operation before proceeding to Clip2–RMA[1].

 

I have looked into setTimeOut, and taken numerous stabs at it.  I remain stumped.  Suggestions, please?