06. januar 2009 - 08:49
Der er
1 kommentar og
1 løsning
Sound.position nulstilles ikke
Hej
Når jeg loader en ny lydfil bliver position ikke nulstillet, men der tælles videre fra hvor den forrige kom til.. duration bliver rigtig nok ændret når ny fil loades?
Nogen som kan hjælpe?
Det er lavet i Flash8 og afspilles i Flash10
player_stream.loadSound(track_url, true);
player_stream.onLoad = function()
{
player_time_total = player_stream.duration;
tst_txt.text = player_id_loaded+' = '+player_stream.position+' / '+player_time_total;
}
07. januar 2009 - 00:48
#1
her er der lidt mere kode :)
var tst = _root.createEmptyMovieClip('tst', _root.getNextHighestDepth());
var tst_txt = tst.createTextField('txt', tst.getNextHighestDepth(), 400, 0, 0, 0);
tst_txt.autoSize = true;
tst_txt.type = 'input';
tst_txt.background = 0x000000;
tst_txt.border = true;
var tst_stream = new Sound();
var tst_total;
var mcbtn1 = _root.createEmptyMovieClip('tst', _root.getNextHighestDepth());
drw_rect(mcbtn1, 500, 40, 20, 20);
mcbtn1.onPress = function()
{
var track = 'audio/1.mp3';
tst_stream.loadSound(track, true);
tst_stream.onLoad = function()
{
tst_total = tst_stream.duration;
onEnterFrame = function()
{
tst_txt.text = track+' '+tst_stream.position+' / '+tst_total;
}
}
}
var mcbtn2 = _root.createEmptyMovieClip('tst1', _root.getNextHighestDepth());
drw_rect(mcbtn2, 500, 70, 20, 20);
mcbtn2.onPress = function()
{
var track = 'audio/2.mp3';
tst_stream.loadSound(track, true);
tst_stream.onLoad = function()
{
tst_total = tst_stream.duration;
onEnterFrame = function()
{
tst_txt.text = track+' '+tst_stream.position+' / '+tst_total;
}
}
}
function drw_rect(mc, x, y, width, height, color, stkWidth, stkColor)
{
if(stkWidth)
{
mc.lineStyle(stkWidth, '0x'+stkColor);
width -= stkWidth;
height -= stkWidth;
}
mc.beginFill('0x'+color);
mc.moveTo(x, y);
mc.lineTo(x+width, y);
mc.lineTo(x+width, y+height);
mc.lineTo(x, y+height);
mc.lineTo(x, y);
mc.endFill();
}