View Full Version : Music Library for Sencha Animator

2 Nov 2011, 1:46 AM

What is the best js sound library to use in Sencha animator, to allow sounds on iPhone / iPad ?
I need sounds that can be linked to event.
Is it possible to create events in Sencha Animator, or do I have to manage events myself in js ?

Best regards,

2 Nov 2011, 2:16 PM
You should be able to use any sound library.

To include a external library in Animator, go to the Project tab in the property panel. There you can add a script tag to your library in the "Head HTML" section e.g.

<script src="http://link/to/buzz.js"></script>

You could also add a link to some initialization code you have as well, or write it directly in a script tag e.g.

<script type="text/javascript">
//set up some sounds
soundA = new Sound(......

Finally, to tie it in to click events in Sencha Animator you can use the "Click Action" property of any stage object and set it to "Custom JS" and then open up your editor and add the js to play some sounds e.g.

soundA.play() //or something similar

2 Nov 2011, 2:23 PM
Thank you,

I had thought of using Buzz library sound! :) So I will.
Everything is clear.

But there is a point i'm interested in also.
I want to fire events (that play sounds), but not only on mouse click on any image, but on image appearing. Is it possible ? Can I create custom events and fire them when a specific image appears on the scene ?

Thank you,
Best regards.

2 Nov 2011, 2:42 PM
Currently there are four types of events that are exposed in animator.

Scene Start
Scene End
Mouse move
We're working on adding more. If you need more events you can add your own javascript to handle that. One way to go about adding your own events is to give objects in Animator a "CSS ID" and then you can refer to them from javascript by using document.getElementById('theObjectID') and attach events.

9 Apr 2012, 9:23 AM

I'm a total beginner with both Animator and JS so I'd be very happy if someone could explain why I can't get buzz.js to play the first 30s of my 3m ogg file (under Linux) when a new scene is opened although I can hear the examples (under Firefox/Iceweasel) on the buzz.js homepage fine.

From reading this thread and the buzz docs, my guess was that if I put:

<script src="/linux/path/to/buzz.js"></script>

<script type="text/javascript">
var mysound = new buzz.sound("/linux/path/to/my.ogg");

In Project > Export > Head HTML then for the scene that I want to trigger the playing of my.ogg with buzz.js I have inserted under Properties > Actions > Custom JS

mysound.setTime( buzz.fromTimer("00:30") );

I'm not hearing anything yet - please help!

9 Apr 2012, 9:43 AM
Not very familiar with Buzz, but have you tried adding the .play method?


mysound.setTime( buzz.fromTimer("00:30") );

Also, have you checked the js console for any errors?

9 Apr 2012, 10:17 AM
Hi arnebech!

First off, I forgot to say thanks in my previous posting (which was the first on these forums) to Sencha for releasing Linux builds of Animator because Linux has needed an alternative to Flash (and now Edge of course) for a long time so Animator fills a previously void yet important niche in the Linux graphics and web design stack and is what I shall be recomending for that purpose now it seems.

You were correct


Is actually all that was required for the custom JS code to trigger my ogg file

mysound.setTime( buzz.fromTimer("00:30") );

Is only required if you want to start playback from 30s in.


2 May 2012, 8:08 AM
I have seen buzz working with Safari. Does it work in Chrome? Have you checked for any js errors, and are you sure the path is correct?