XML Object: GetBytesLoaded() And GetBytesTotal Returns Same
i am trying to build a preloader for loading XML documents, but getBytesLoaded() and getBytesTotal returns the same number as the document is loading.
has anyone heard of a problem with this?
DevShed > Flash Help
Posted on: November 22nd, 2005, 04:39 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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...
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..
_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() Returns -1 ?
I've got a clip called ImageContainer and within a clip called Image. On the root timeline I have a loadMovie command that loads a movie into _root.ImageContainer.Image
I am trying to preload the content into Image, but on displaying getBytesTotal() for the image it returns -1. Anyone know what I am doing wrong?
The code to display the total bytes is inside ImageContainer i.e. this.Image.getBytesTotal();
Thanks
GetBytesTotal Returns 0
This is really doing my nut, i'm preloading an external jpg into a movie on my stage, with a preloader on the main stage rather than the loaded movie, but it always return 0 to getBytesTotal(). Here's the code:
Code:
_root.createEmptyMovieClip('holder', 2);
holder.loadMovie("img1.jpg");
holder._x = 50;
holder._y = 50;
var l = holder.getBytesLoaded();
var t = holder.getBytesTotal();
if (l<t) {
this.texttotal.text = Math.round(t/1000)+'kb total';
gotoAndPlay (1);
} else {
// fully loaded
this.texttotal.text = "loaded";
//this._visible = false;
}
GetBytesTotal Returns 0
This is really doing my nut, i'm preloading an external jpg into a movie on my stage, with a preloader on the main stage rather than the loaded movie, but it always return 0 to getBytesTotal(). Here's the code:
Code:
_root.createEmptyMovieClip('holder', 2);
holder.loadMovie("img1.jpg");
holder._x = 50;
holder._y = 50;
var l = holder.getBytesLoaded();
var t = holder.getBytesTotal();
if (l<t) {
this.texttotal.text = Math.round(t/1000)+'kb total';
gotoAndPlay (1);
} else {
// fully loaded
this.texttotal.text = "loaded";
//this._visible = false;
}
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 Returns NaN
Hi,
Firstly apologies if this appears somewhere else - I've not been able to find a post with the same problem that I'm having.
I'm loading an external JPEG into a placeholder movieclip using the loadMovie method. This all works fine. I'm trying to provide feedback on how much has loaded using the moviclip_name.getBytesLoaded method. Here's the AS in the first frame:
percentLoaded = Math.floor((imagePlaceholder_mc.getBytesLoaded()/imagePlaceholder_mc.getBytesTotal())*100);
where:
percentLoaded = a variable to hold the percentage loaded
imagePlaceholder_mc = the movieclip I'm loading into
I have a dynamic textfield with the variable 'percentLoaded' that shows the percentage of the image loaded.
The problem I'm having is that, at the start, percentLoaded is being shown as 'NaN' - not a number. I'm presuming that this is because Flash hasn't worked out getBytesTotal yet and so the equation defining percentLoaded isn't a number. Am I right?
I have tried various scripts to determine whether percentLoaded is, or contains, NaN, if it does then display "calculating" etc. but to no avail. I've also tried setting percentLoaded to '0%' but I still get 'NaN% loaded' in my textfield until some of the image has actually started loading - most annoying!
Has anyone got any ideas?
Many thanks,
J
GetBytesLoaded Returns No Value
The fallowing preload does not work and I don't know why
on frame 1 : button gotoplay(2)
on frame 2 : movieclip loadBar and a textfield called loadText and with the fallowing AS :
loadMovieNum("1.JPG", 1);
bytes_loaded = Math.round(_level1.getBytesLoaded());
bytes_total = Math.round(_level1.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
_level1._x = 400;
_level1._y = 150;
this.gotoAndstop(4);
}
///////////////////////////////////////
on frame 3 : gotoplay(3)
on frame 4 : statique text "Image loaded" with stop
problem : there is no bytes counting . loadText and loadBar do not work.
I think that (_level1.getBytesLoaded() ) is no the command tu use to refer to the image 1.JPEG loaded with loadMovieNum("1.JPG", 1);
GetBytesLoaded Returns No Value
The fallowing preload does not work and I don't know why
on frame 1 : button gotoplay(2)
on frame 2 : movieclip loadBar and a textfield called loadText and with the fallowing AS :
loadMovieNum("1.JPG", 1);
bytes_loaded = Math.round(_level1.getBytesLoaded());
bytes_total = Math.round(_level1.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
_level1._x = 400;
_level1._y = 150;
this.gotoAndstop(4);
}
///////////////////////////////////////
on frame 3 : gotoplay(3)
on frame 4 : statique text "Image loaded" with stop
problem : there is no bytes counting . loadText and loadBar do not work.
I think that (_level1.getBytesLoaded() ) is no the command tu use to refer to the image 1.JPEG loaded with loadMovieNum("1.JPG", 1);
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.
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!
Preload For _level1 Returns No GetBytesLoaded
The fallowing preload does not work and I don't know why
on frame 1 : button gotoplay(2)
on frame 2 : movieclip loadBar and a textfield called loadText and with the
fallowing AS :
loadMovieNum("1.JPG", 1);
bytes_loaded = Math.round(_level1.getBytesLoaded());
bytes_total = Math.round(_level1.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
_level1._x = 400;
_level1._y = 150;
this.gotoAndstop(4);
}
///////////////////////////////////////
on frame 3 : gotoplay(3)
on frame 4 : statique text "Image loaded" with stop
problem : there is no bytes counting . loadText and loadBar do not work. the
script says that the condition if (bytes_loaded == bytes_total) on frame
enter is true so it immediately jumps to this.gotoAndstop(4); altough
the 700ko JPG is not loaded yet
I think that (_level1.getBytesLoaded() ) is no the command tu use to refer
to the image 1.JPEG loaded with loadMovieNum("1.JPG", 1);
Can someone help me?
Preload For _level1 Returns No GetBytesLoaded
The fallowing preload does not work and I don't know why
on frame 1 : button gotoplay(2)
on frame 2 : movieclip loadBar and a textfield called loadText and with the
fallowing AS :
loadMovieNum("1.JPG", 1);
bytes_loaded = Math.round(_level1.getBytesLoaded());
bytes_total = Math.round(_level1.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
_level1._x = 400;
_level1._y = 150;
this.gotoAndstop(4);
}
///////////////////////////////////////
on frame 3 : gotoplay(3)
on frame 4 : statique text "Image loaded" with stop
problem : there is no bytes counting . loadText and loadBar do not work. the
script says that the condition if (bytes_loaded == bytes_total) on frame
enter is true so it immediately jumps to this.gotoAndstop(4); altough
the 700ko JPG is not loaded yet
I think that (_level1.getBytesLoaded() ) is no the command tu use to refer
to the image 1.JPEG loaded with loadMovieNum("1.JPG", 1);
Can someone help me?
Newbie Question: GetBytesLoaded() Always Returns 12
I'm pretty much a newbie when it comes to Actionscript, but bear with me please. How is it that when I use _root.getBytestLoaded() it returns the correct loaded size of the whole swf file.
But when I use MovieClip.getBytesLoaded() (or getBytesTotal()) on a movieclip (for instance one that contains just an image) it always returns the numbers 12. That's strange.
For instance, I have a movieclip that has one image inside it.The movieclip's instance name is hats. And when I use hats.getBytesLoaded() it always returns 12.
Newbie Question: GetBytesLoaded() Always Returns 12
I'm pretty much a newbie when it comes to Actionscript, but bear with me please. How is it that when I use _root.getBytestLoaded() it returns the correct loaded size of the whole swf file.
But when I use MovieClip.getBytesLoaded() (or getBytesTotal()) on a movieclip (for instance one that contains just an image) it always returns the numbers 12. That's strange.
For instance, I have a movieclip that has one image inside it.The movieclip's instance name is hats. And when I use hats.getBytesLoaded() it always returns 12.
Sound.getBytesLoaded() Returns Total Bytes
I am experiencing difficulties with the Sound.getBytesLoaded() function.
I'm using Sound.loadSound() to load MP3 files from a server, but when I call getBytesLoaded() on one, it seems to return the total bytes of a sound no matter what.
This is an abridged version of my preloader script:
Code:
sounds = _root.createEmptyMovieClip(sounds, 0);
sounds.one = new Sound();
sounds.two = new Sound();
sounds.one.loadSound("one.mp3", false);
sounds.two.loadSound("two.mp3", false);
progressBar.bytesTotal = sounds.one.getBytesTotal() + sounds.two.getBytesTotal();
// The following code is on a progress bar movie clip:
onClipEvent(enterFrame) {
bytesLoaded = sounds.one.getBytesLoaded() + sounds.two.getBytesLoaded();
_width = bytesLoaded / bytesTotal * 100;
if (bytesLoaded == bytesTotal) {
_root.gotoAndStop(4);
}
}
The empty movie clip for sounds is required for other functionality in my movie.
When I trace sounds.one.getBytesLoaded() inside the progress bar script, I always get the same bytes as the total size of the sound. This happens both locally and when loading from a server. I've also tried downsizing the functionality by removing the empty movie clip and not using a separate progress bar, but the result is the same.
Is there something I've missed in my script?
Flash version: MX
ActionScript version: 2.0
Operating System: Windows XP
LoadVars Object And GetBytesTotal
hey all, I have been searching many forums and still have not come across a solution with the getBytesTotal problem (nothing returned: value undefined) when loading a CFM file.
Could any Coldfusion/Flashers out there help me with this dilemma? I know it has something to do with http headers and the value of content-length... but I thought those values would be generated by the server automatically?!
Thanks in advance!
Problem With GetBytesTotal() Of LoadVars Object
I have run into a problem with getBytesTotal() function of LoadVars object (probably the same function in XML object will exhibits same behaviour).
I have a php-generated page (variables) that I load into flash. All works OK except getBytesTotal(). I believe it is because originally I did not pass Content-Length header with the page, so getBytesTotal has returned undefined. Until here it has been all as I have expected and by the book (manual .-).
So I have add the header, I buffer output and use ob_get_length() function in PHP. It seems it returns correct header, but then all loading to flash fails - LoadVars load() retuns false. I have failed in finding any clue why so. When I just get rid off Content-Length header it works again all ok, but naturaly the problem with getBytesTotal() is back.
Does anyone experienced something simillar either with LoadVars or XML?
Thanks in advance...
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.
[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.
GetBytesLoaded Problem When Loading Sound Object
Hello everyone,
When I load an external .mp3 into Flash, I try to get a value for getBytesLoaded() within an onEnterFrame event handler so I can use that to figure out the progress of the .mp3 as it downloads. However, I only get a value that is the total file size (even though I call that separately with getBytesTotal()). Is there a bug with the Sound object when attempting to get these parameters?
Here is my code (which is on the 4th frame as the playhead goes here after preloading the entire main clip):
Code:
stop();
music_file = "audio_test.mp3";
onEnterFrame = function(){
loadedBytes = site_audio.getBytesLoaded();
totalBytes = site_audio.getBytesTotal();
percentDone.text = int((loadedBytes/totalBytes) * 100);
site_audio.onLoad = function(success:Boolean){
if(success){
trace("success!");
delete onEnterFrame;
gotoAndStop(5);
} else {
trace("Audio did not successfully download!");
}
}
}
site_audio = new Sound(this);
site_audio.loadSound(music_file,false);
Any feedback or direction is appreciated. Forgot to add that I have my publish settings at FP 7 and AS 2.0 with all classes exporting to the third frame for the main movie preloader. Not sure if that info matters but I didn't want to leave it out.
Thanks in advance for any feedback!
Button._name Returns Object?
Hi. I am trying to utilize mybutton._name in my flash application.When I trace
code:
trace(myButton._name)
it returns
code:
_level0.myButtonName
What is with the _level0 i am not able to use my buttons name because of that.
I tried using array access around it such as myButton[_name] etc but I cannot seem to return the name.
Hope that makes sense jamesloacher.
Preloader Problem - _root.getBytesLoaded() Doesnt Include Sound Object?
I am using a function based on _root.getBytesLoaded() in a preloader progress bar, which I always use and works fine
I am working on a particular project that has quite a large sound track file, and since adding this, the preloader doesnt work right, the screen is blank for about 8 seconds before the preloader appears, and even then the progress bar is about 90% complete when it DOES appear.
Am I right in thinking that the large sound file is being ignored (removing it cures the delay)
FYI, the movie is 2 scenes, first is the preloader. The sound object for the big file is declared at the start of scene 2
Thanks!
GetBytesLoaded() Or Math.round(getBytesLoaded())
hi have a problem with my preloader it is in scene1 and when it loads it goes to scene2 it works fine on my computer but when i upload it to the web it doesn't work right the preloader bar shows up allready loaded can any body help me, here is the script i'am using:
ActionScript Code:
total_bytes=_root.getBytesTotal();
loaded_bytes=_root.getBytesLoaded();
remaining_bytes= total_bytes - loaded_bytes;
percent_done=int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
ifFrameLoaded("main",11){
gotoAndPlay("main",1);
}
Sending Text With "RETURNS" Through A Button To A Dynamic Textfields With "RETURNS"
I have a dynamic textfield which I am loading text into through a button. Here is the button code
on (press) {
_root.about = "this is my text that is loaded into a dynamic text field named about";
}
I'm trying to make returns appear in the dynamic textfield
HERE is what I would like the text to look like in the dynamic textfield
this is my text
that is loaded into a
dynamic textfield named about
I tried using /n in the button script but nothing appeared.
n (press) {
_root.about = "this is my text /n
that is loaded into a /n
dynamic text field named about";
}
SO What Really Is GetBytesTotal()?
Here is a quick question on the getBytesTotal() function.
When calling this funtion on the _root movie,
i.e _root.getBytesTotal()
It is understood that it will return the total number of bytes of the _root movie.
NOW...
What if the root movie have an empty movieclip on it which is linked to a symbol in a shared library, and is purely there for registration purposes...
Then does getBytesTotal() return the TOTAL including the shared library (which is what I would expect as it is also needed to run the movie) or just the main root movie not taking into account any linkages.
The reason for my question is that I have put a very simple preloader into the first frame of a movie, but when the movie resumes play at frame 2 it seems to have only been half loaded with the linkage part coming in later....and then some other bits of the main root movie after that...
The movie has in fact not fully loaded.
Any ideas in this pls...would be greatly appreciated.
Many thanks
regards
GetBytesTotal()...?
I have been using the method getBytesTotal(), but I have been having a problem with it...so far, I have only been successful using it on _root; if I try to get the total bytes for a MC, it gives me bogus numbers.
For Ex., I have a MC (homeImage) with a large jpg (50k.) When I do:
homeImageBytes = homeImage.getBytesTotal();
and I see the value of homeImageBytes in a dyn txt field, it gives me some wack value like 223 bytes - what's up with that. Why can't I get the # of bytes for a particular MC, but can for root?
Thanks,
Brian Riley
GetBytesTotal
Hello guys. I have this problem: I want to make an instance (movieclip)that contains the "getBytesLoaded" and "getBytesTotal" commands and i want to insert it into my "main" scene so that it shows a progress bar and when it loads to show my logo instead of the progress bar. I know the code looks like this:
if(?.getBytesLoaded()!=?.getBytesTotal())gotoAndPl ay (10)
} else
{
gotoAndPlay (1);
}
;
I don't know what I should put in the code instead of the exclamation marks!
Be carefull!!!I don't want it to be a preloader because I want the user to see the frames at the time that are downloaded not all of them. I just want him to know how many bytes are there left to be complete (don't ask me why!)
Thank you
GetBytesTotal
How can I apply the (getBytesLoaded / getBytesTotal) method on a movie thatīs being loaded into a main one?
When I use:
percent = Math.round((_root.getBytesLoaded()/_root.getBytesTotal())*100) add "%";
it seems that (_root) is refering to the main movie, and not the movie in particular. So what happens is that it goes directly into the next scene and the animation gets all mess up. The file is 205K so itīs not that small to jump without preload.
Suggestions are welcome
-----
Manuel
|