Using setTimeOut, delay a callAS "multimedia_play"

New Here ,
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, Create PDFs, Edit and convert PDFs, General troubleshooting, How to, PDF forms, Rich media and 3D

Views

267

Likes

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

Using setTimeOut, delay a callAS "multimedia_play"

New Here ,
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, Create PDFs, Edit and convert PDFs, General troubleshooting, How to, PDF forms, Rich media and 3D

Views

268

Likes

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
Feb 20, 2020 0
Most Valuable Participant ,
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.

Likes

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
Reply
Loading...
Feb 20, 2020 0
Most Valuable Participant ,
Feb 20, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Feb 20, 2020 0
Adobe Community Professional ,
Feb 20, 2020

Copy link to clipboard

Copied

Use this:

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

Likes

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
Reply
Loading...
Feb 20, 2020 0
New Here ,
Feb 20, 2020

Copy link to clipboard

Copied

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.

 

Likes

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
Reply
Loading...
Feb 20, 2020 0