Sound.duration Continues To Increase After GetBytesLoaded()==getBytesTotal()?
Try this:
ActionScript Code: var s = new Sound();s.loadSound('sound.mp3',true);onEnterFrame = function(){ var a = s.duration+" : "+s.getBytesLoaded()+" / "+s.getBytesTotal();}
Have sound.mp3 or whatever in the same dir as the fla. Test movie, and simulate download. Notice that the Sound.duration continues to steadily increase even after getBytesLoaded()==getBytesTotal()! Example: 45166 : 201558 / 201584 45322 : 201584 / 201584 // done loading bytes 45558 : 201584 / 201584 // duration increasing?? 45793 : 201584 / 201584 // still increasing?! and continues for a long time
I was trying to extrapolate the duration of the mp3, since Sound.duration only returns milliseconds of audio downloaded when loadSound stream is set to true(like above). I got so close, but fear I'm stuck. The discrepancy created by this is as long as 10 seconds, which is not acceptable. I am probably going to have to settle for a nasty alternative, like creating id3 tags(ug) or manually enter all the timestamps into XML. If any gurus have any last ideas, I'm all ears.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 01-11-2007, 07:44 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[streaming Sound] GetBytesLoaded And Duration
Does anyone know a solution to this problem? Please
Intro:
When you trace mySound.duration while you are streaming an mp3, you won't get the correct length but approximately the length of the part of the mp3 file which already has been loaded.
Now it should be possible to calculate the total length with the loaded Bytes:
ActionScript Code:
var p= mySound.getBytesLoaded()/ mySound.getBytesTotal()
var correctLength = p* mySound.duration
But the loaded Bytes are tricky !
Question:
Why does the Bandwidth Profiler in the testing mode of Flash show a lower value of loaded Bytes than when i use trace (mySound.getBytesLoaded()) ?
Remark:
mySound.duration stops increasing at the same time as when the Bandwidth profiler says that loading has finished.
Sound.duration Lags Behind Sound.getBytesLoaded()
This is crazy:
Code:
l = 1779801 t = 1782285 p = 99.8606283506846 dur = 210
l = 1782285 t = 1782285 p = 100 dur = 211
l = 1782285 t = 1782285 p = 100 dur = 212
l = 1782285 t = 1782285 p = 100 dur = 213
l = 1782285 t = 1782285 p = 100 dur = 213
l = 1782285 t = 1782285 p = 100 dur = 214
l = 1782285 t = 1782285 p = 100 dur = 215
l = 1782285 t = 1782285 p = 100 dur = 215
l = 1782285 t = 1782285 p = 100 dur = 216
ActionScript Code:
var l:Number = my_sound.getBytesLoaded();
var t:Number = my_sound.getBytesTotal();
var per:Number = (l/t)*100;
//
trace("l = " + l +" t = " + t +" p = "+per+" dur = "+Math.round((my_sound.duration/1000)));
Has anyone ever experienced this problem of the Sound.duration property lagging behind the Sound.getBytesTotal()? This seems rather ridiculuos! And yes, this happen online too, not just locally!
Help - GetBytesTotal() And GetBytesLoaded()
hi,
i wonder if anybody can help me,
i have a movie clip called "imgholder" which is on the stage of a movie called main.swf.
I am using "imgholder" to load external .swf files.
This is fine, however when i try to use flash5's new object style code,
e.g. imgholder.loadmovie("test.swf")
Or
loaded = imgholder.getBytesLoaded();
it doesn't work.
At the moment i am using:
loadMovie ("test.swf", "imgholder");
and
test = getProperty("imgholder", _framesloaded);
to achieve the above.
I have also tried using _root.imgholder.getBytesLoaded();
to no avail. should i be using levels?
Thanks in advance,Ben.
Mac GetBytesLoaded() And GetBytesTotal()
in my flash app i have the block:
Code:
if(_root.main_mc.loader_mc.getBytesLoaded() == _root.main_mc.loader_mc.getBytesTotal())
{
...
}
works fine on a pc. i don't think mac supports getBytesLoaded() and getBytesTotal(); i've had some buggy problems in the past with it on a mac. is this true? any way around it?
thanks
Getbytesloaded/getbytestotal ?
I have a few problems with getbytesloaded/getbytestotal.
offline, when I try to trace their value from an object (on stage) in witch I loaded a JPG they both give me the same value. (usually 18 and then around 44 thousands...)
then online I can't trace their value but flash seems to react as if they are both equal. which makes it impossible to make a loader, because
getbytesloaded/getbytestotal always returns 1.
anyway here's how I'm trying to do this.
on 1st frame I got:
content.loadMovie("files/" + _root.selected +".jpg");
then on the 3rd frame:
bl = content.getBytesLoaded();
bt = content.getBytesTotal();
if (bt != bl) {
bar._xscale = bt/bl;
gotoAndPlay(2);
} else {
content._visible = true;
play()
}
thanks..
How To Use GetBytesLoaded And GetBytesTotal
Hey, can anyone help me get this section of code to work? What I am trying to do should be pretty self explanitory . . .
Code:
function swf(clip){
loadMovie("box.swf",clip)
bytesLoad = getBytesLoaded();
totalBytes = getBytesTotal();
if (bytesLoad = totalBytes) {
fadout = setInterval(fade,30,this);
}
trace("function swf is working");
}
GetBytesLoaded() == .getBytesTotal
Hi Forum,
I want to have two preload scenes, pre_load1 scene checks
if (_root.getBytesLoaded() == _root.getBytesTotal())
{
_root.gotoAndPlay("Main", 1);// skip pre_load2 scene and play Main scene
}
If not go to pre_load2 scene and download.
Reason is for repeat visitors so they dont have to view preload again. cheers P
GetBytesLoaded() / GetBytesTotal()
Hello there... I have a small problem with getBytesLoaded() / getBytesTotal() for use with a preloader. I know how to make a preloaded, but ive decided to make a preloader on a specific level that will be loaded into the embedded swf.
so the preloader is accessed by _level200
this works fine. I can use getBytesLoaded() / getBytesTotal() to find out how much is loaded.
example:
Code:
myLoader.myKBs.text = _level0.getBytesLoaded() add "kb/" add _level0.getBytesTotal() add "kb";
//OR use it to get to level the loader is inside
myLoader.myKBs.text = this.getBytesLoaded() add "kb/" add this.getBytesTotal() add "kb";
but the second i try any level BUT "_level0" or "this" then I just get undefined!!! Any ideas? Btw, I KNOW the other levels are there because they are showing up in the embedded file.
thanks guys/gals
GetBytesTotal & GetBytesLoaded?
Hi
I want to load a picture from outside my site and get the size info of that file.
But when I use getBytesTotal & getBytesLoaded it's only return 0 byte.
Code:
...
newImg_mc.loadMovie("http://www.helpexamples.com/flash/images/image1.jpg");
...
trace(newImg_mc.getBytesTotal());
trace(newImg_mc.getBytesLoaded());
...
I want to know the filesize of a file outside my site.
And to be able to see the downloaded bytes.
please someone!
/Stenberg
GetBytesLoaded() & GetBytesTotal()
Say I have 2 files (file a, file b) and I want to use file a to load file b (in a blank movie clip symbol). The problem is that file b has a preloader that uses _root.getBytesLoaded() & _root.getBytesTotal() in it.
These values, however, return the size of 'file a', what should I put in place of _.root (which is in 'file b') so that it returns the size of 'file b' even if I load it from somewhere else?
Thanks
GetBytesloaded && GetBytesTotal Undefined
I'm loading an external swf on a button release. Since the external swf was small I initially didn't have a preload check. The first time the button is clicked the swf doesn't load, but the on the second click the swf would load and play.
I tried using basic tests with _framesloaded and even tried a comparison with (getBytesloaded & getBytesTotal). If all cases , _framesloaded and getBytesloaded & getBytesTotal return "undefined" and the swf loaded only have the second click.
Any ideas.
Lisa
GetBytesLoaded()/getBytesTotal() = Headache
Got a flash piece at http://www.lake.k12.fl.us/makearipple.asp that pops it in a new window.
Problem is, preloader shows up on some machines, not others.
Real frustrating. Because it will show up, say, on a p4 2+ GHZ machine as well as a 128 MB Ram AMD older machine, but won't show up on similar machines running same software, browser and players.
I'd rather use getBytesLoaded vs ifFrameLoaded -- site is a bunch'a mcs that play when buttons are activated, etc. getBytesLoaded is more accurate than ifFrameLoaded in this case.
Also, want preloader to load dynamically, which, as I said above, it does in most cases. It's the times that it chugs along before jumping strait in to the main movie that's got me all frustrated.
Any suggestions are appreciated.
I've tried multiple variations.
Here's preloader code:
----------------------------------
stop();
myInterval = setInterval(preloader, 10);
if (getBytesLoaded() == getBytesTotal()) {
nextScene();
}
function preloader() {
if (getBytesLoaded()>=getBytesTotal()) {
play();
clearInterval(myInterval);
}
myTextField.text=(Math.round(getBytesLoaded()/getBytesTotal())*100)+"% loaded";
progressBar._xscale=(getBytesLoaded()/getBytesTotal())*100;
mask._xscale=(getBytesLoaded()/getBytesTotal())*100;
mask._yscale=(getBytesLoaded()/getBytesTotal())*100;
ripple._xscale=(getBytesLoaded()/getBytesTotal())*250;
ripple._yscale=(getBytesLoaded()/getBytesTotal())*250;
ripple._alpha=(getBytesLoaded()/getBytesTotal())*50;
ripText._alpha=(getBytesLoaded()/getBytesTotal())*100;
}
----------------------------------
Thanks,
Andy
_level1 GetBytesLoaded/getBytesTotal.. Help
Does anybody know how can I make my preloader.. if I want to load music from _leverl1 ?
setProperty("_parent.load_bar", _xscale, ((_level1.getBytesLoaded()/_level1.getBytesTotal())*100));
//this script doesn't work for me
Thanks..
GetBytesLoaded Returns GetBytesTotal...
Okay what I am trying to do should be pretty simple... I've done it quite a few times before but I'm getting nowhere this time. Here's my setup.
I have a main swf that simply is used to load other swfs as links are clicked. Now two different swfs are always loaded at the same time. One is a banner that contains the menu which is never unloaded. And the other is the content swf that is changed as the links are clicked.
Here's the setup: It's not as optimized as it could be because I've been messing it up continuously trying to find the problem.
Code:
//SNIPPET: this is in the banner.
if (loading) {
loading = _root.checkLoading();
if (!loading) {
turnOn();
}
}
//SNIPPET:this is in the main swf
function checkLoading() {
var rbool:Boolean = true;
var loaded:Number = content.getBytesLoaded();
var total:Number = content.getBytesTotal();
lbar.lbar._xscale = loaded/total*100;
lbar.perc = loaded;
if (total == loaded && total > 1) {
rbool = false;
}
return rbool;
}
//SNIPPET: Last here's the setup for content which is also in the banner
if (_root.chg == "2d") {
loadMovie("2dViewer.swf", _root.content);
} else if (_root.chg == "3d") {
loadMovie("3dViewer.swf", _root.content);
} else if (_root.chg == "web") {
loadMovie("webViewer.swf", _root.content);
} else if (_root.chg == "contact") {
loadMovie("contact.swf", _root.content);
} else if (_root.chg == "about") {
loadMovie("about.swf", _root.content);
} else if (_root.chg == "home") {
loadMovie("main.swf", _root.content);
}
Okay now here's my problem. content.getBytesLoaded() returns the same as content.getBytesTotal(). And no it's not 0... it's a large amount of bytes that I am assuming is the actual Total. And it's not loaded yet either, one of the swfs is about 2.5 megs and says it is loaded but it's not even close...
Am I doing something stupid? Probably... if you can help me that would be awesome! In the mean time... I'll scratch my brain some more...
_level1 GetBytesLoaded/getBytesTotal.. Help
Does anybody know how can I make my preloader.. if I want to load music from _leverl1 ?
setProperty("_parent.load_bar", _xscale, ((_level1.getBytesLoaded()/_level1.getBytesTotal())*100));
//this script doesn't work for me
Thanks..
GetBytesLoaded And GetBytesTotal Isnt Getting
Hi! Im going crazy! It seems no matter how I try to get the bytes loaded and total, its not getting them. Im loading a picture into a holder. The swf loads into the holder fine, but the preloader isnt working because the bytes loaded and total are always 0. Here's the code Im referring to...
function load_pic(myLoad, myNum:Number)
{
//this loads the picture into backpics
_root.mc_backpics["img" + myNum].loadMovie(myLoad);
//this is what I cant get working. myLoad isnt referencing the file I think
total = myLoad.getBytesTotal();
loaded = myLoad.getBytesLoaded();
percent = int(loaded/total*100);
and here's how I call it...
var myPage = 1;
load_pic("backpics/pic" + [myPage] + ".swf", myPage);
Thanks!
Rich
MovieClip.getBytesLoaded() And GetBytesTotal() == 0?
For some reason when I load a movie clip these functions always seem to return 0 to me. Does this mean that it loads the movie with the LoadMovie method from the cache memory which makes that value 0? Even then I'd think it would still display that number.
I load it like this in a frame:
LSL=loadingScreen.getBytesLoaded();
LSL shows 0 as a value when I do Debug - List Variables when testing it. It's the same for LST=loadingScreen.getBytesTotal();
Btw I load the MovieClip like this and in the next frame I update those LSL and LST variables:
_root.createEmptyMovieClip("loadingScreen",2);
_root.loadingScreen.loadMovie("LoadingScreen1.swf");
Of course those both values being 0 will always end up in this if statement to fail:
if(LSL<LST){
gotoAndPlay(1);
}
Suggestions to let these methods return the correct values are appreciated a lot.
GetBytesLoaded Showing As GetBytesTotal About 50% Of The Time. Help.
I am loading a sound file and have a loop that continually checks getBytesLoaded and compares it to getBytesTotal.
unfortunately the getBytesLoaded is returning getBytesTotal about 50% of the time and then it doesn't download the file at all.
I have stripped it down to the bare bones just checking getBytes Loaded and can't figure out why this is happening.
I am loading the sound off of a button click and if I click the button 5 or 6 times it usually kicks in and starts showing getBytesLoaded but that is not really acceptable. The funny thing is sometimes it goes on the first click. Can anyone give me any hints.
My guess is it has something to do with the large file size and my slow internet connection but then many other people will have a similarly slow conntection.
Problem With GetBytesLoaded And GetBytesTotal With A SendAndLoad
I can't get it work. It's loading fine, but I can't find a way of retrieving the informations. I would like to do a preloader, so I need the getBytesLoaded and getBytesTotal
here is the code I have done :
Code:
stop();
var sendData:XML = new XML();
var replyXML:XML = new XML();
checkProgress = function() {
var lvBytesLoaded:Number = replyXML.getBytesLoaded();
var lvBytesTotal:Number = replyXML.getBytesTotal();
trace("Loaded "+Math.floor(lvBytesLoaded/lvBytesTotal)*100);
};
replyXML.onLoad = function(success:Boolean) {
clearInterval(intervalID);
if (success) {
trace(replyXML.getBytesLoaded()+" Bytes sent.");
} else {
trace("error");
}
};
sendData.sendAndLoad("http://127.0.0.1/RandomThoughtsHandler.ashx", replyXML);
var intervalID:Number = setInterval(checkProgress, 100, replyXML);
GetBytesTotal() And GetBytesLoaded() Not Working When Loading Jpg File Into MC...hlp
Using MX, anyone see a problem with getBytesLoaded() and getBytesTotla() not being returned correctly using this code? Does not work for me. movBirdContainer is just an empty mc with 1 empty frame.
Code:
movBirdContainer.createEmptyMovieClip("movBird", 1);
movBirdContainer.movBird.loadMovie("./image.jpg");
onEnterFrame = function()
{
// Preloader code
var nLoaded = Math.round(movBirdContainer.movBird.getBytesLoaded() / 1024);
var nTotal = Math.round(movBirdContainer.movBird.getBytesTotal() / 1024);
trace("total bytes loaded is: " + nLoaded);
trace("total bytes is: " + nTotal);
trace("percent loaded is: " + Math.round((nLoaded / nTotal) * 100));
}
GetBytesLoaded() And GetBytesTotal() Return Nothing When Loading Content From Another Domain
I have created a movie that loads various media using loadMovie() and then in many cases performs actions on the newly loaded MCs once the loading is complete. I'm relying on getBytesLoaded and getBytesTotal to know when to run these actions.
This works just fine when the content is on the same server as the movie, but I also need to load content from another domain and this is where it falls apart. The media is actually loading just fine into the target MCs, but the functions that should be running when loading is complete never do. The problem is that getBytesLoaded() and getBytesTotal() both return nothing when the content is loaded from another domain.
I'm stuck with loadMovie and the getBytesLoaded/getBytesTotal check as this movie must be published for Flash Player 6, but I have actually tried using loadClip() and onLoadInit() and I get the same problem - onLoadInit() never runs.
Another weird thing is that testing by previewing in flash doesn't show this problem - the content loads fine and getBytesLoaded and getBytesTotal both return values as expected. It's only when I publish the movie and view in a browser that I have this problem.
Where am I going wrong?
Thanks!
[f8] SetInterval Duration To Increase Exponentially
Hi Chaps,
You know setInterval has a duration setting on it?
This duration setting "hits" a function at the time specified.
So if i set my duration on the setInterval call it will remain at that constant
duration.
How would you change the duration in a setInterval function to get double as fast or double as slow on each/next interval?
Take this incorrect code for example to get an idea:
function display() {
trace("hey dude!!");
}
var nInterval:Number = setInterval(display, "double duration each interval");
The output would in the correct example start out tracing fast and then get really slow.
I think that explains it pretty well.
If you have done this before or have any ideas how to do it I would be so happy if you could take the time out to help.
Thanks in advance
Mc Stops But Sound Continues
I have a one frame master timeline. On this frame I have some mc that play illustrations of shapes being formed when a button is pressed. On the coordinating frames of these mc I have added narration to the timeline. The mc's all visually start and stop when the corresponding buttons are clicked however sound continues playing resulting in narrations for multiple shapes being formed regardless of which shape's mc is playing.
How can I stop the sound of one mc when the next mc starts?
I'ma bit of a greenhorn so go easy on me. Thanks
Sound Equalizer Continues After My Song Has Finished
hello all, i have a
sound equalizer and it continues after my song has finished!!!
what i have to do ?
if (_root.soundAnalyzer.pornit){
_root.soundAnalyzer.soundON();
}
stop ();
in the OFF button this is the code
on (release) {
if (_root.soundAnalyzer.pornit){
_root.soundAnalyzer.soundOFF();
_root.soundAnalyzer.pornit = !_root.soundAnalyzer.pornit;
}
this one works - the equalizer it stops
but i want when the song is finished as well ??
this is the code
Please Stop The Music Sound Continues After Another Movie Loaded
Help!
I have multiple movies playing in a file based on button clicks. This part works fine, it's just that the sound won't stop from a previous movie (it hasn't finished) when you click to see the next.
Here's what I have:
var fileName:String="begin.swf";
var loader:Loader = new Loader();
var requestURL:URLRequest = new URLRequest(fileName);
loader.load(requestURL);
holder.addChild(loader);
airButton.addEventListener(MouseEvent.CLICK,airBut tonListener);
earthButton.addEventListener(MouseEvent.CLICK,eart hButtonListener);
function airButtonListener(event:MouseEvent):void {
loadFile("air-JWfinal.swf");
}
function earthButtonListener(event:MouseEvent):void {
loadFile("earth-JW.swf");
}
function loadFile(fileName:String):void{
requestURL.url = fileName;
loader.load(requestURL);
holder.addChild(loader);
}
Can anyone help???
Sound.position And Sound.duration On Flash Lite 2.1
I'm using the code below to trace the position and duration of a loaded mp3 file. This works fine when I export as normal flash 9 version swf, though when I export as flash lite 2.0 or 2.1, the trace returns 0 for both position as well as duration. Here is suggested that the two members should be available for all flash lite 2.x versions. Is there a way to find the duration and position of an mp3 file in flash lite 2.x? Am I doing something wrong?
Thank you in advance,
Harry
Attach Code
var mySound:Sound = new Sound();
mySound.onLoad = function(success){
if(success == true) {
mySound.start(0, 0);
}
}
mySound.loadSound("sound.mp3");
function onEnterFrame() {
trace(mySound.duration + " " + mySound.position);
}
Edited: 02/05/2008 at 08:42:28 PM by Harry Vermeulen
Sound.getBytesLoaded
Hey everyone,
I'm curious how to preload sound. I have the following basic code:
var mysound = new Sound();
mysound.attachSound("thesound");
mysound.start();
When I try and add mysound.getBytesLoaded() I get some kind of undefined error when I trace the value of it. Could someone shed some light on how to make a sound file preload. Also, what does this mean: var mysound = new Sound(this)
Thanks everyone for your help
Sound.getBytesLoaded() Bug?
Anyone knows whether sound.getBytesLoaded() has a bug?
The codes i am using are:
Code:
onClipEvent(load)
{
bgSound = new Sound();
bgSound.loadSound("abc.mp3");
}
onClipEvent(enterFrame)
{
percentLoaded = Math.round((bgSound.getBytesLoaded()/bgSound.getBytesTotal())*100);
_parent.display = percentLoaded + "%";
trace("loaded: "+ percentLoaded);
}
it always tells 100%.
i have trace the bgSound.getBytesLoaded(), but it tells the size same as bgSound.getBytesTotal();
Can anyone help me ?
Sound.getBytesLoaded() Bug?
Anyone knows whether sound.getBytesLoaded() has a bug?
The codes i am using are:
Code:
onClipEvent(load)
{
bgSound = new Sound();
bgSound.loadSound("abc.mp3");
}
onClipEvent(enterFrame)
{
percentLoaded = Math.round((bgSound.getBytesLoaded()/bgSound.getBytesTotal())*100);
_parent.display = percentLoaded + "%";
trace("loaded: "+ percentLoaded);
}
it always tells 100%.
i have trace the bgSound.getBytesLoaded(), but it tells the size same as bgSound.getBytesTotal();
Can anyone help me ?
GetBytesTotal() Method Of The Sound Object
Hello there!
What's the purpose of the getBytesTotal() method of the Sound object since it returns the same value as the getBytesLoaded() method? Note that I mean streaming mode here.
Loadmovie / Getbytesloaded / No Sound?
Hello one and all.
I have a problem that is giving me some serious bumcakes right now.
I have a main movie that loads various external swfs into container clips on the main stage at startup. They're all ok except for the one that deals with music.
The music swf, being the largest physically, has a preloader built into it (with the action:
if (_root.getBytesLoaded() != _root.getBytesTotal()) {
gotoAndPlay (1);
}
on frame 2, and the music itself contained on frame 5. An on / off toggles between frame 5 (on) and frame 10 (off)).
The thing is, when uploaded to the server, the loaded music file preloads very quickly, suggesting that the 'getbytes' section of the swf isn't taking the sound file into consideration at all. This seems to be confirmed by the fact that I can't hear any music!
Anyway, to add to this, I thought 'well, I'll leave it for a bit to see if the sound comes in EVENTUALLY'. But nothing happens. The only way you can get to hear the music is by flicking the toggle to 'off' and then back on again. Which is pretty undesirable.
I dunno if this can be sorted via linkage, loadmovienum, or messing with the sound sync settings. Anyone have any ideas?!
the URL: http://www.telekin.co.uk/cv.htm
(the song is called 'Not For 555', at the top left).
...Oh and don't laugh at me, it's not finished yet (as you've probably guessed by my presence here).
Thanks to those who get this far! All correspondence welcome!
telekin:
________________________________
[MX] How To Use GetBytesLoaded With The Sound Object?
I'm having trouble using the getBytesLoaded and getBytesTotal methods for the sound object. In my movie on the Actions layer I have four frames with the following ActionScript:
Frame 1
Code:
mySound = new Sound();
mySound.loadSound("darkclouds.mp3", false);
Frame 2
Code:
bytesLoaded = this.getBytesLoaded();
bytesTotal = this.getBytesTotal();
soundBytesLoaded = mySound.getBytesLoaded();
soundBytesTotal = mySound.getBytesTotal();
if (bytesLoaded == bytesTotal && soundBytesLoaded == soundBytesTotal) {
gotoAndStop(4);
}
Frame 3
Code:
gotoAndPlay(2);
Frame 4
Code:
mySound.start();
stop();
On the stage I have 4 dynamic text fields that are used to display the bytesLoaded, bytesTotal, soundBytesLoaded, soundBytesTotal. The soundBytesLoaded doesn't seem to update when I test the movie in 'Show Streaming' mode. I have no idea whats going wrong. I've been working on this for 2-3 weeks now with no result. I'm pretty much begging for help here. All I want to do is understand how to get the getBytesLoaded and getBytesTotal methods working with the sound object in the most simplest form.
Sound.getBytesLoaded Proplems, Help
I am trying to program a preloader for external MP3 files,
the sound var is called MP3ToPlay so i figure my code should be as follows;
bytes_loaded = Math.round(_root.MP3ToPlay.getBytesLoaded());
bytes_total = Math.round(_root.MP3ToPlay.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
loadText1 = Math.round(getPercent*100)+"%";
Though in the text box all i am getting is NaN%
what might this problem be?
source files online at
http://www.philipbell.org/drphil/webtest/
Edited: 07/31/2008 at 03:29:21 PM by DOC_PHILIPPE
Sound Duration Bar, PLEASE HELP :)
i have made an mp3 player that loads mp3s from a dir on my server and streams them. i made a duration bar (duration_mc) to show how much of the song has elaped:
duration_mc.onEnterFrame = function(duration){
this._xscale=my_sound.position/my_sound.duration*100;
it works for the first song, but then when you click another track it will continue from where it left off on the previous song.
my question is, how can i make the duration bar reset to the beginning when you click to stream another song?
Get Sound Duration Without Id3?
Anyone know if it's possible to to acertain the duration of an externally-loaded mp3, either by time or frames? I'm working on a project where the user records a voice message as an mp3, which is then loaded into a .swf. The .swf contains a movie clip which is supposed to play while the Sound's playing, and stop when the Sound's finished. HOWEVER, the mp3s don't have an .id3.TIME property attached so that property can't be accessed . Many thanks.
How To Get Sound Duration?
i am loading mp3sounds .swf into empty movie clip how to get the sound duration of every song using dynamic text box..
About Sound Duration
Hi I'm newby here and I want some help.
I just building a MP3 Player and load the external MP3 file into flash and I load it as a stream. I want to get the duration of the song for update my progress bar and now I using "sound.duration" to get that but this value will change when the whole file is not loaded (I mean if it loaded 1 sec. it return 1sec so that is not the actualy song duration)
Is there any method to get the file duration at the begining of sound loaded.
thank you and sorry for my English
Get Sound Duration
hi everyone!
i'm trying to pass to a dynamic text field the duration of a sound in seconds.
how can i do that?
thanks
How To Get Sound Duration?
i am loading mp3sounds .swf into empty movie clip how to get the sound duration of every song using dynamic text box..
Sound Duration
hey guys,
I'm trying to use the sound property duration and position to change the background image of a MC.
when the sound is 25% done playing I want to tell another clip on the _root to gotoAndPlay frmae (2);
here's what I've tried
sound.onEnterFrame = function () {
if (sound.duration/4 == sound.position) {
_root.background_MC.nextFrame();
}
}
but it jsut sit there?
can do do this using onSoundComplete, but I want to change 4 time during the play back?
anyhelp?
jef
Sound Duration
I'm importing an MP3 on the fly and it's approx 69000ms seconds long.
However, when I trace the sound duration, it comes out 24890ms. It's losing 45 seconds The MP3 itself seems to be fine when I open it in sound forge. Anyone experienced this before?
Check For Sound Duration
Does anyone knows how to check for sound duration?? I mean using action script to check for it, not manually using stop watch. I have a music attached using scripts, I need to check that when the song ends, everything puts to a stop.
Any idea anyone??
|