Sound restarting in wrong place
i created play/pause/track slider control sound. no animation @ all. traces, can see new sound position being calculated correctly. when sound restarts, closer end of sound should be. snippets below:
public function playaudio(event:event = null):void
{
if(media.channel)
{
media.channel.stop();
}
media.channel = media.audio.play(media.soundresume);
}
public function pauseaudio(event:mouseevent = null):void
{
controller.removeprogress(cntl_mc);
media.soundresume = media.channel.position;
media.channel.stop();
if (soundmixer.aresoundsinaccessible() == false)
{
soundmixer.stopall();
}
}
public function processdragbar():void
{
pauseaudio();
cntl_mc.progress_mc.bar_mc.startdrag(false, new rectangle(0,0,cntl_mc.progress_mc.track_mc.width - cntl_mc.progress_mc.bar_mc.width, 0));
}
public function processdropbar():void
{
var percentage:number = (cntl_mc.progress_mc.bar_mc.x / (cntl_mc.progress_mc.track_mc.width - cntl_mc.progress_mc.bar_mc.width));
media.soundresume = (percentage * media.audio.length);
playaudio();
cntl_mc.progress_mc.bar_mc.stopdrag();
}
public function processtrack():void
{
cntl_mc.progress_mc.bar_mc.x = media.newtrackx;
var percentage:number = (cntl_mc.progress_mc.bar_mc.x / (cntl_mc.progress_mc.track_mc.width - cntl_mc.progress_mc.bar_mc.width));
if (percentage >= 1)
{
media.soundresume = 0;
pauseaudio();
}
else
{
media.soundresume = (percentage * media.audio.length);
}
playaudio();
}
hi,
if using cs4, please update has fix sound delay issue.
http://blogs.adobe.com/rgalvan/2009/05/flash_cs4_update_now_available.html
hope helps.
More discussions in Adobe Animate CC - General
adobe
Comments
Post a Comment