Hi,
It really depends on the computer.
got the same issue, but for me soundChannel.position never reached the
sound.length (which is actually higher than it should be : my sound is a
perfect 8.0s and the length is 8.054).
try this:
when you start a sound and a timer at the very first frame, the difference
beetween soundChannel.position and the getTimer() should be the same, but
they are not.
So I guess we just can't count on the soundChannel.position (getTimer() is
right as i know)
(don't forget to link a sound in the library with SoundTrack class Name)
var soundChannel:SoundChannel;
var soundTrack:SoundTrack = new SoundTrack();
var timer:Timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER,timerHandler);
// here we start the sound and the timer
soundChannel = soundTrack.play();
timer.start();
function timerHandler(p_event:TimerEvent):void
{
var pos:Number = soundChannel.position
var time:Number = getTimer()
// the difference should always be the same but it is not
trace ("soundChannel.position: " + pos + " getTimer(): " + time + " diff:
" + (time- pos))
}
also this feed doesn't respond to the "BUG" but it explains the way adobe is
dealing with its flash player and sound issues
http://www.kaourantin.net/2008/05/adobe-is-making-some-noise-part-1.html
regards
Nicolas
--------------------------------------------------
From: "Steven Sacks" <[EMAIL PROTECTED]>
Sent: Thursday, August 07, 2008 8:16 AM
To: "Flash Coders List" <[email protected]>;
<[EMAIL PROTECTED]>
Subject: [Flashcoders] BUG: Channel.position returns out of range
positionson looping Sounds
I don't know if this has been documented or not. I've never seen anyone
report it.
If you set a Sound to loop, it's channel.position property returns a
number out of range of the Sound.length after it loops. The position
property just keeps on incrementing beyond the length when you loop a
sound.
If you try to play a Sound from that out of range position, the Sound
glitches out, because that position is invalid. Flash should not return a
position to you that you cannot use.
This all revolves around the fact that Sound has absolutely no way to
pause right now. I don't know why Adobe did not give us a channel.pause()
method, but they didn't. Because they didn't, this bug gets worse.
The only way to pause and unpause a sound in Flash is to store the current
position of the channel and call channel.stop, and when you unpause, you
call sound.play(position).
If the sound is looping, the position returned will eventually be higher
than the length, which means the Sound glitches because you're passing an
out of range position, a position, once again, that Flash returned to you
as VALID.
Wait, it gets worse. If you unpause a looping sound by passing its
position, when it loops, it will loop from that position, not the
beginning of the Sound. Do you see how this gets worse?
There is no pause method, and without a pause method, there is no
workaround for the above bug and issue except to manually loop a Sound by
adding an event listener to the sound complete event (which can be
unreliable), and calling play on it again and managing the looping
manually, which undermines the loops argument of the Sound.play() method
and requires a fair amount of code.
We need a channel.pause(flag:Boolean) method.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders