PDA

View Full Version : why it's not showing


toke
04-09-2003, 08:54 PM
can anyone tell me why this code is not working when I view from a server?

I have

mSound = new Sound();
mSound.loadSound("mp3/temp.mp3");

var fullyLoaded = false; //this I got from other post
sndFrameFunc(); //same, got from other post

//got from other post -- thank you very much very helpful and useful

function sndFrameFunc(){
if(!this.fullyLoaded){
var t = mSound.getBytesTotal();
totalbytes.text=t;
var l = mSound.getBytesLoaded();
bytesloaded.text=l;
var pc = l/t;
percentdone.text=pc*100 + "%";
this.loadBar2._width=pc*100;
if(t && l == t){
this.fullyLoaded=true;
}
}
};



it returned the following values:
total bytes >> showed nothing
bytes loaded >> 0
percentdone >> NaN%

but when I view this from a local machine, the code worked. anybody knows?

CyanBlue
04-10-2003, 05:57 AM
I just copied and pasted the code and that crashed my Flash every time I do the test movie... :(

toke
04-10-2003, 02:23 PM
:eek: sorry about that cyanblue. i'll work it out some more and see what can I do to preload mp3. you have any ideas?

toke
04-10-2003, 02:39 PM
cyanblue... can you try the attach file please? and see if it crashes your flash again. I tried it but didn't crash. you might have to change the mp3 file name.

CyanBlue
04-10-2003, 09:04 PM
Um... I don't understand why you are keep asking me to crash my Flash... :mad:

:D Kidding...

I tested your file and my file and the results are in...
It was the MP3 file that's crashing my Flash... I just got it copied from one of those games that I had installed... and it was the devil... I didn't bother what setting it was in though...

Anyways... I did check your file and just put the loop in it and uploaded it right here (http://members.lycos.co.uk/jasonje/Tests/test3.html)... and found out that it was working just fine... See it for yourself... ;)mSound = new Sound();
mSound.loadSound("coolloop.mp3");
sndFrameFunc();
//test load sound
function sndFrameFunc()
{
if (!this.fullyLoaded)
{
this.onEnterFrame = function()
{
var t = mSound.getBytesTotal();
totalbytes.text = t;
var l = mSound.getBytesLoaded();
bytesloaded.text = l;
var pc = l / t;
percentdone.text = pc * 100 + "%";
this.loadBar2._width = pc * 100;
if (t && l == t)
{
this.fullyLoaded = true;
delete this.onEnterFrame;
result.text = "Deleting onEnterFrame within if block...";
}
};
}
}

toke
04-10-2003, 09:09 PM
:D hee hee sorry for making you crash your machine man! anyway, thank you for the solutions.

thank you sir,
toke