PDA

View Full Version : Looping music?


whisperstorm
11-10-2003, 10:10 AM
I have an application which fetches an mp3 of unknown length (unknown before the fetch). I want to load that mp3 and then loop it indefinitely. I see that it's possible to start and stop a clip, and to determine it's length in time. Would I just have to set up a timer to "play" the clip starting right again after it ends? Or is there some option that would make looping easier?

antun
11-10-2003, 01:09 PM
There is an onlastframe event that you can use:


<canvas debug="true">
<simplelayout axis="y" spacing="5" />

<view name="foo">
<method event="onlastframe">
debug.write( 'stopped' );
foo.play( 1 );
</method>
</view>

<button>Play
<method event="onclick">
var url = 'choofenhoufen.mp3';
foo.setSource( url );
foo.play();
</method>
</button>

</canvas>

whisperstorm
11-11-2003, 01:40 PM
Works perfectly! Thanks!