Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 12:49 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Script instead of elements
PostPosted: September 17th, 2018, 7:05 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Hi,
I am working on a project that starts mp3 files by reaching a certain number.
Now i use the if > then option and that works fine, but there must be an easier and maybe better way to do it by script.
I have to start over 400 mp3 files so the list will be very long and i think it's much better to put it in one script.

The end result will be a HTML5 publication.

Kind Regards,
Ad Mulders

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: Script instead of elements
PostPosted: September 17th, 2018, 11:53 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Yes, it's quite simple.

Add an Opus HTML5 object to the page and in the code box add:
Code:
<audio id="myAudio"> </audio>

This places an Audio Object on the page.

Then when you want to play an audio file call the following code from a standard Opus Script action:
Code:
var myAudio = document.getElementById("myAudio");  //fetch the audio object above.
n = 1 // name of file.
myAudio.src = n + ".mp3" // change the source for the audio object.
myAudio.play();  // play the file - note small 'p'.


You could also make myAudio a global variable and then you wouldn't have to fetch it each time.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


For this message mackavi has been thanked by : Ad Mulders


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group