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);
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 03-10-2004, 07:33 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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 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...
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
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";
}
How To Use Getbytesloaded?
I've been trying to use getbytesloaded on my movie preloader to display the number of bytes loaded and a real percentage, but I cant asign that value to a variable and then use it on a textbox... It always displays "getbytesloaded" on the textbox, not the evaluated fnc.
Can some one help me out with this?
Thanks!
GetBytesLoaded
My friends are working on a project.
On preloading a new movie before moving on to the next, we have tried with this:
int((_level32.getBytesLoaded()/_level32.getBytesTotal())*100)
But this gives a percentage of 100 % straight away. This should return a low percentage at first, right...?
The movie in level 32 is not loaded at the moment when this scripts starts.
Help!!?!
this is the entire if-phrase:
if (_level32._framesloaded<_totalframes) { prsverdi = int((_level32.getBytesLoaded()/_level32.getBytesTotal())*100);
ogndalsveienv = prsverdi add " % loaded";
} else { ogndalsveienv = 100 add"% loaded";}
GetBytesloaded
hi,
i done the script is not working out , the problem is the swf is directly jump to "scene 1 FRAME2", nothing loading effect appeaered!
scene1 ~ loading(MC) ~ cube(MC) ~ "load1" to "load10"(MC)
On scene 1
FRAME 1 has a loading(MC)
FRAME 2 is action "this.stop()" and content
On loading(MC)
layer 2 FRAME is cube(MC)
layer 1 FRAME 1 is action like that:
loadedSize = _parent.getBytesLoaded();
totalSize = _parent.getBytesTotal();
if (loadedSize>=totalSize) {
_parent.gotoAndPlay(2);
} else {
percent = (loadedSize/totalSize)*100;
gDownloaded = Math.round (percent);
_parent.stop();
if (gDownloaded<=10) {
if (cube.load1.flug == true) {
cube.load1.gotoAndPlay(2);
cube.load1.flug = false;
}
} else if (gDownloaded<=20) {
if(cube.load2.flug == true);
for (i=1; i<=1; i++) {
eval ("cube.load"+i ).gotoAndStop("end");
cube.load2.gotoAndPlay(2);
cube.load2.flug = false;
}
______ALSO" load3 - load9 script" _____
} else if (gDownloaded<=100) {
if (cube.load3.flug == true) {
for (i=1; i<=9; i++) {
eval ("cube.load"+i ).gotoAndStop("end");
cube.load3.gotoAndPlay(2);
cube.load3.flug = false;
}
thankz!
GetBytesLoaded...HELP
Hi,
I am having trouble unerstanding how this works.
My situation:
My main movie has a some buttons. I also have an MC on FRAME one that HOLDS, 3 OTHER MC's. These 3 (internal) MC's each have a stop in FRAME 1, and in FRAME 2, they call an external .swf. The buttons on the MAIN time line target those inner MC's and start them playing at FRAME 2 "AND" change the swapDepth of each clip. (calling it forward)
The problem I encounter is people are saying that when they click a button, nothing is happening right away. They have a delayed reaction.
The external .swf should be played right away correct? The external.swf is set up that you will see a looping animation until the rest of itself is loaded. I was told that using the getBytesLoaded method was my answer.
So what i need now is an EASY explaination of how I can have a little loader bar give me the percetage/progress of when/how much is left for the EXTERNAL.swf that will be loaded inside the HOLDER MC (and that will be swapDepth'd)
I am not sure as to how this shoudl be set up. I hope I was clear. I need help pretty soon..this is killing me!
Any advice is appreciated. Thanks
-whispers-
her is a link to what I am talking about.....I have used the SAME BACKGROUND image for each external.swf just to take up some filler (kb's)
http://www.dmstudios.net/shake/index_1.html
Help With GetBytesLoaded() Please?
I'm trying to get the movie to display a "loading" message as a large JPG is getting loaded. But as it loads, I'm getting nothing.
(My code at the bottom.)
I have a Dynamic Text Box named dtfLoadingMsg, well...I've called it that in that VARIABLE field and the instance name, but neither way produces any results.
Any clues?
Thanks!
Liam
(EDIT: Actually, I get dtfLoadingMsg.text to work if I name the dynamic text box's instance name "dtfLoadingMsg" and leave the var field blank. But it still won't display anything while the image loads.)
this.createEmptyMovieClip("mc", -1);
this.mc.createEmptyMovieClip("imgHolder_mc", -1);
imgHolder_mc.onLoading = function() {
dtfLoadingMsg.text += "
loading: " + this.hhh.getBytesLoaded();
};
imgHolder_mc.onComplete = function() {
dtfLoadingMsg.text += "
" + " done: " + this.hhh.getBytesTotal();
};
this.mc.imgHolder_mc.loadMovie("images/11.jpg", "hhh");
this.mc.imgHolder_mc._x = 186.2;
this.mc.imgHolder_mc._y = 5.0;
Help With GetBytesLoaded() Please?
I'm trying to get the movie to display a "loading" message as a large JPG is getting loaded. But as it loads, I'm getting nothing.
(My code at the bottom.)
I have a Dynamic Text Box named dtfLoadingMsg, well...I've called it that in that VARIABLE field and the instance name, but neither way produces any results.
Any clues?
Thanks!
Liam
(EDIT: Actually, I get dtfLoadingMsg.text to work if I name the dynamic text box's instance name "dtfLoadingMsg" and leave the var field blank. But it still won't display anything while the image loads.)
this.createEmptyMovieClip("mc", -1);
this.mc.createEmptyMovieClip("imgHolder_mc", -1);
imgHolder_mc.onLoading = function() {
dtfLoadingMsg.text += "
loading: " + this.hhh.getBytesLoaded();
};
imgHolder_mc.onComplete = function() {
dtfLoadingMsg.text += "
" + " done: " + this.hhh.getBytesTotal();
};
this.mc.imgHolder_mc.loadMovie("images/11.jpg", "hhh");
this.mc.imgHolder_mc._x = 186.2;
this.mc.imgHolder_mc._y = 5.0;
GetBytesLoaded ?
please where can i learn about this:
getBytesLoaded() and getBytesTotal()
to make a real percentage preload.
(movie or tutorial)
thanks
mau.
GetBytesloaded For A Url?
Hello, i know how to make a preloader on a flash file, but lets say i want a preloader for my entier html based website.
is it possible to some how to getbytesloaded and total from a url rather than flash scene?
otherwise how would i go about my situation? Basically i have an html template with 2 seperate swf files on them. I want one preloader to calculate both swf's even though they are completly seperate from eachother. I have to some how track them both down and add them together in my preloader...
HERES THE SITE
( i deleted all the html pics so u can see where its html and where its flash)
Any tips guys?
Thanks alot.
Gil
GetbytesLoaded For URL?
Hello,
I need to make a preloader for an entire html site containing multiple flash peices (swf's).
I know how to make a preloader for one flash file using the getbytesloaded/total function for the entire flash file.
how would i make one preloader which calculates multiple swfs in an html template?
is there some way i can make it getbytesloaded/total for an entire URL? if not how would i go about this?
Any help would be great
thanks alot
gil
GetBytesLoaded
Hey I want to replace _framesloaded and _totalframes with
_getBytesLoaded and_getByteTotals. This is my AS but can not seem to get it to work using Bytes method.
onEnterFrame = function() {
framesLoaded = (Math.ceil (( _parent._framesloaded / _parent._totalframes) * 100));
gotoAndStop (framesLoaded);
info_txt.text = framesLoaded + "% completed";
if (framesLoaded >= 100) {
_root.gotoAndPlay ("Start");
}
}
I want to change it to the Bytes method for a smoother more even preloader, just can't seem to get it right. I am using MX2004. This is what I thought it would look like.
onEnterFrame = function() {
framesLoaded = (Math.ceil (( _parent._getBytesLoaded / _parent._getTotalBytes) * 100));
gotoAndStop (framesLoaded);
info_txt.text = framesLoaded + "% completed";
if (framesLoaded >= 100) {
_root.gotoAndPlay ("Start");
}
}
Don't know, Im lost, could you help please, Thanks...
3DWANNABE......
First.GetBytesLoaded() + Second.. + Etc.
I keep getting NaN when I try to do this:
Code:
loaded1 = movie1.getBytesLoaded();
loaded2 = movie2.getBytesLoaded();
loaded3 = movie3.getBytesLoaded();
totalLoaded = loaded1 + loaded2 + loaded3
However, when I just try:
Code:
totalLoaded = loaded1 + loaded2
then it works fine and the numbers show up on my dynamic text with variable totalLoaded. Is there a 2 preperty limit for this, and if so how would I calculate more than 2?
GetBytesLoaded() = 0, Sometimes
edit: Sorry guys, I titled the thread wrong... it's actually getBytesTOTAL = 0
hi.. I'm doing a project in which you click an icon and it takes you to a display of that work.
Images are loaded one by one on the right and as soon as they are flash begins loading the next image... after 15 seconds, if the next image is loaded, they all move down 1 to show the next one and again flash begins loading another image in the background.
okay.. standard stuff... the images loop, and they are named in a numbered sequence, if the image file flash is looking for still has getBytesTotal = -1 after the 15 seconds.. flash starts loading the the first image again (creating the loop).
OKAY.
my problem is, everynow and then, getBytesTotal = 0 ; even for files that have previously loaded fine in other iterations of the loop.
it continues equalling 0 and so the image sequence does not progress forward.. I have done some testing and attempted to work around it with no luck...
what I have done:
I added code to check when it equals 0 and after it’s equalled it for 15 seconds, try and load the same file again.. no avail, still 0… so I tried skipping the file and loading the next one… still no luck.. still = 0.
once it gets to that point all images it tries to load in have zero total bytes... I've checked the filepath and it is fine.. but even if it was wrong.. it would give me -1 ... not 0.
I've tried it on two hosting spaces to see if it happened specifically in one but no.. happens in both...
any ideas?
thanks,
Dale.
GetBytesLoaded();
Hi.
I am loading an MP3 from the server and am getting variable results with getBytesLoaded();
I am attaching the MP3 to a MC and testing for its bytes loaded, but sometimes it returns the total bytes - and other times if works fine. I have tried clearing my cache - but I get the same strange results.
Is there anyway to ensure that the REAL bytesloaded is being accessed?
thanks
Using Getbytesloaded
I am dynamically creating a movieclip and loading an image an external JPEG image into it on mouseover using a routine like the following:
_root.final.clip1.btn1.onRollover= function(){
_root.createEmptyMovieClip("container", 2);
_root.container.loadMovie("images_home/image1.jpg")
_root.container._x = 10;
_root.container._y = 20;
trace("Over btn1")
_root.container.onLoad = fadeIn;
}
My qustion is how can I display the amount (kb) loaded for that externally loaded movie/image... I want to use a dynamic text field 'holder' on the stage that displays the the total number of kb that is loaded until it has fully loaded.
Help?!?!
Targeting GetBytesLoaded
Is there anyway of targeting a seperate level to use in a Preloader.
My Preloader is on Level 15 and the movie loading in is in Level 1,
I thought you would do it like this:
_level1.getBytesLoaded
but its not working, any help would be muchos appreciated
Pete
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.
GetBytesLoaded In Sub-movies
If I do a "mc.getBytesTotal()" where "mc" contains an image.
(no loadMovie or anything) I get the result "12 bytes" even though the MC contains a large image...
Is there a way to calculate the size of a MC inside a movie, without having to split things into several movies (to get a accurate size-report)..
Sorry, wrong title: I meant getBytesTotal (not getBytesLoaded)
Thanks,
FF
GetBytesLoaded Of LoadScrollContent
Is it possible to get the BytesLoaded of an image or movie being loaded into a scrollpane?
could I just say...
myBytesLoaded = Pane.getBytesLoaded();
And then have the textField in an MC with 2 frames so it can raise the value progressively?
function LB() {
LBsel = LBox.getSelectedIndex();
switch(LBsel){
case 1:
Pane.loadScrollContent("bla.jpg");
myBytesLoaded = Pane.getBytesLoaded();
pane.refreshPane();
}
}
Problems With Getbytesloaded
a site that i'm building has three movies playing at the same time, exchanging variables and such. one movie functions as a loader, and loads the two other movies.
the two other movies are the navigation bar, and the webpages. both are loaded into placeholder movie clips on the loader movie. both these movies begin with a stop action.
in the loader i laod the movies in to the place holder movie clips, and then i use the getbytesloaded command
loaded (variable) = nav(movieclip).getBytesLoaded() + page(movieclip).getBytesLoaded() + _root.getBytesLoaded();
total (variable) = nav(movieclip).getBytesTotal() + page(movieclip).getBytesTotal() + _root.getBytesTotal() ;
it then checks to see if the two variables, loaded and total are equal befor moving on.
this all works fine localy but when i acess it from the internet, i don't think the movies has enough time to evauate all of those getbytesloaded commands before the two variables are compared.
so when it goes to compare them it see's that neither one has a value, so they are equal, and the movie continues beofe it is loaded.
a simple sloution would be to add frames between the two scripts, but i'm looking for a command that will check to see if total, and loaded, contain a numerical value.
thanks
www.audiorise.com/flashsite/index.html
GetBytesLoaded Question
I'm wondering if someone can help me with a preloading routine.
From the action script below, you'll noticed that I'm loading photographs into a movie clip, and I'm attempting to obtain the amount of bytes that are being loaded, but it's not working at all.
Perhaps there is no way to obtain the amount of bytes loaded when you're loading into a movie clip? In a previous frame, I have the photos loading into an empty movie clip called Pic_Movie.
Frame 1 labeled "LoadCheck"
var totalKB;
var KB;
var percentLeft;
totalKB = Math.round(Pic_Movie.getBytesTotal()/1000);
KB = Math.round(Pic_Movie.getBytesLoaded()/1000);
KBLeft = totalKB - KB;
percentLeft = Math.round((Pic_Movie.getBytesLoaded()/totalKB)/10);
if (KB==totalKB) {
with(Loading_Movie){
stop();
_alpha = 0;
};
gotoAndStop("End");
}else{
with(Loading_Movie){
_alpha = 100;
play();
}
}
Frame 2
gotoAndPlay("LoadCheck");
Frame 3 Labeled "End"
stop();
Getbytesloaded Preloader
I working on a preloader using the following method:
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
play();
}
I'm wondering if there is a way to use the getBytesLoaded to be equal to a precent of the total bytes loaded, say 50% instead of 100%. So that I can get the movie to begin playback at 50% of the total Bytes loaded. Can anyone explain how to do this or is there a tutorial that explains how to do this? Thanks in advance.
-Dman100-
_root.getBytesLoaded
Can anyone tell me what the _root. means?
It sounds silly but I don't understand it and Flash Help is useless.
GetBytesLoaded() - Problem...
Hello! :)
I have a problem, and i dont know how to solve it.
If anyone could help, i appreciate very much.
I have the following code:
_root.onEnterFrame = function() {
if (square_alpha == false) {
bar:percentage = Math.round((square.getBytesLoaded()/square.getBytesTotal())*100) add " %";
if (square.getBytesLoaded() == square.getBytesTotal()) {
square_alpha = true;
}
}
};
You can see this code working in:
www.hugodesign.com
I use it to show the percentage when loading JPG's to "square" Movie Clip. It works in Internet Explorer Browser, but in Netscape 7.1, the variable "percentage" in the "bar" Movie Clip show me the "NaN" value.
Does anyone know why it hapens?
Thanks for your help!!!
Hugo Silva
Boolean Or GetbytesLoaded ?
What is the more practile preloader, a boolean value or getbytesLoaded and what are the differences apart from the obvious coding differences.
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..
GetBytesLoaded, Relatively Speaking
i'm having problems checking the bytes loaded when i try to make relative paths of the following:
Code:
loadTarget = undefined;
this.createEmptyMovieClip("loadChecker", this.getNextHighestDepth() );
loadChecker.onEnterFrame = function ()
{
if (loadTarget == undefined || loadTarget == _level0 ) {
movieLoad = _root.getBytesLoaded();
} else {
movieLoad = _root.feature.getBytesLoaded();
}
}
this preloader is used to determine 1st whether it's preloading itself, or a feature movie(_root.feature), then getting the bytesLoaded for that target.
i'm looking for a Flash Player 6 solution:
i want to make all my code with relative paths. i've replaced "_root" with "this" and "_parent" to no avail. this preloader code is on the _root layer. the load checker is in a movieclip on the root level. anyone know what i'm doing wrong?
also, this code checks the "if" statement on every call of this loadChecker. is there a better way so it checks the "if" once?
thanks,
jwt
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
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");
}
[F8] TextField.getBytesLoaded
I couldn't figure out what to call the thread title
I load in some HTML data from an XML file to a textfield.
I know I can find out when the XML data has been fully loaded with xmlData.onload
..but if I have an image in that HTML data - in an image tag of course - can I find out when that image (or preferebly all the data) has been downloaded.
I need to know this because the Textfield is autosized and a scroller is attached to the parent movieclip if the textfield needs is it (if the data resizes the textfield soo it's higher than my MC).
And I run into all kinds of problems because the scroller is attached when the onLoad is called which of course is before the image in question is downloaded - which results in the scroller being attached before the entire HTML content is downloaded and shown.
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 Display
I have a flash site that I would like to display the bytes being loaded WITHOUT actually making it a preloader. Is this possible? I can't seem to figure it out due to being relatively new to ActionScript.
Any help would be greatly appreciated!
Darren E
GetBytesLoaded() Misreporting
Working on a preloader to track multiple external .jpg's. Working great except the first time I call getBytesLoaded() or getBytesTotal() on the mc I'm loading the .jpg into it misreports the total bytes and total loaded as 10 for all images. Then next time through the onEnterFrame cycle it reports correctly as the images load. Anyone see this behavior before?
Problem GetBytesLoaded
hi,
iám building a preloader in a diferent scene for external swf, the problem is that the bar isn`t loading with the Bytesloaded, i don´t know what´s going on kind of new to this can anybody help with the script kind of desperate
var bytes_loaded= Math.round(getBytesLoaded());
var bytes_total= Math.round(getBytesTotal());
getPercent= ((bytes_loaded/bytes_total)*100);
Bar.gotoAndStop(getPercent);
this.loadText= Math.round(getPercent)+"%";
if(bytes_loaded==bytes_total) {
this.gotoAndPlay(3);
}
|