Re: Hiding audio play buttons
Hi Siran
Your New version works exactly how I wanted, but I am having trouble replicating your result.
To test the process I have created a new web page and added the code to the body.
If I import one of your placeholders everything works OK and I can change the audio file - so I understand that bit of the process, but if I create a new object on the page, apply the two names and then add the audio file using ctrl+alt+shift+A nothing happens. I am obviously missing a step somewhere.
Sorry for being so stupid!
Re: Hiding audio play buttons
Could you upload an example? Not sure what might go wrong.
1 Attachment(s)
Re: Hiding audio play buttons
Wow Siran - you are the fastest responder ever!
File attached as requested.
Attachment 112851
Re: Hiding audio play buttons
Only a small change is required. Since your object is a simple rectangle Xara doesn't export it as an image. Just create a more complex button and retry.
Re: Hiding audio play buttons
Hi Siran
Its easy when you know how! (but I didn't! LOL)
Thanks again - especially for your super speedy responses!
Re: Hiding audio play buttons
wonderimg how you can modify this code to work on mobile so that when a button is touched it plays audio
Re: Hiding audio play buttons
how can you modify this code to work in a mobile browser so that when an object is touched an audio file will play?
Re: Hiding audio play buttons
I don't have a mobile device to test on at the moment, but you could try to add a line
Code:
e.addEventListener('touchstart',function(){soundClips[f].play();},false);
below (or above, that really doesn't matter) the line
Code:
e.addEventListener('mouseenter',function(){soundClips[f].play();},false);
if you also would like the sound clip to stop when the user lifts the finger then also add
Code:
e.addEventListener('touchend',function(){soundClips[f].pause();soundClips[f].currentTime=0;},false);
Re: Hiding audio play buttons
Thanks Siran for your code. Now how can one bookmark this thread? And where does one learn to write code like this for Xara?
Re: Hiding audio play buttons
Quote:
Originally Posted by
Mike in Canada
Thanks Siran for your code. Now how can one bookmark this thread? And where does one learn to write code like this for Xara?
Try Thread Tools > Email this Page... & Thread Tools > Subscribe to this Thread...
W3Schools > JavaScript: http://www.w3schools.com/js/default.asp and deconstruct siran's fine examples in TG.
Acorn