• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using setTimeOut, delay a callAS "multimedia_play"

Explorer ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

Here is my ongoing quest -- recently SOLVED, up to the point of delaying display of an Alert, by using setTimeOut.  Now I seek to achieve delaying display of an RMA, similarly.

 

Here's where I need help.  My comprehension of ActionScript is still vague.  I have been able to, in a scrpt,   Play an RMA, by using an rm.callAS operation.  This works, as seen with 'First Clip' on the left side of attached document:

 

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 First Clip [RM List Position# minus 1]
//
if ( !rm.activated ) rm.activated=true; // activate the Clip-annot 
rm.callAS("multimedia_play"); // play First Clip, right away

 

 

 

The 'Second Clip', on the right side, is to play, following a 2.0 sec. delay:

 

var aRM = this.getAnnotsRichMedia(0); // var used to ID any Clip on first page (PDF document page# minus 1)
//
var rm = aRM[1]; // get rich media annot for Second Clip [RM List Position# minus 1]
//
if ( !rm.activated ) rm.activated=true; // activate the Clip-annot 
//
app.setTimeOut (rm.callAS("multimedia_play"), 2000 );  // Play Second Clip, after 2000 milliseconds

 

 

 

I can well imagine problems exist in my comingling of app.Methods, and callAS commands.

 

Comentary appreciated.

 

TOPICS
Acrobat SDK and JavaScript

Views

658

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

Thom Parker already replied in your other thread and correctly mentioned that the first parameter of the setTimeOut method needs to be a string, and it needs to contain your full code. It can reference variables that were declared earlier (if done at the same or a higher scope), but it's better to place all of your code in this parameter. Alternatively, you can place the code in a function and then just call that function, but it still needs to be in the form of a string.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

Surprisingly, your code does work... So I'm not sure what the issue is.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

Use this:

app.setTimeOut ('rm.callAS("multimedia_play")', 2000 );

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 20, 2020 Feb 20, 2020

Copy link to clipboard

Copied

LATEST

I revised, as Bernd suggested.  No change.

 

Also, I've tried to update threads by attaching revised document to a Repy/update [as attached to this Reply].  The attachment seems to upload, but it's not apparent that Forum users can see it.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines