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)); }
FlashKit > Flash Help > Flash ActionScript
Posted on: 02-28-2003, 10:18 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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!
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);
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.
GetBytesTotal For File Without Loading-4 Podcast
Hello kirupa...
So i am building a dynamic podcast creator with flash (and mySQL, amfPHP) for a client who is not a tech person at all.
The podcast will update itself through the CMS we are building for him.
For an iTunes podcast however, i need to include the length of each podcast item in bytes.
Is there a way i can get the file size of the mp3 without fully loading it into a Sound object?
Anybody know? I dont think My client will be able to get and fill in the length in bytes for each entry, so i need a way to do this behind the scenes.
I would like to think that there is a way to do this other than storing the "bytes total" in the database when the client uploads the mp3 through the flash CMS.
ANy help would be hugely appreciated.
GetBytesTotal Not Working After Publishing
Hi there.
I am facing an issue that whilst testing in Flash all works well, but when published my movie doesn't behave.
I am trying to load pictures into my flash movie. No problem at all. It loads local pictures and also those from my site.
For the local pictures the getBytesTotal is working great.
For the once I load from my site it simply doesn't get the total size. It stays 0, no matter how long I tell it to wait and long after the actual picture has been loaded.
How can I fix this? It is driving me nuts!
Cheers
JR
IT = Logic (except for a well known OS where it equals luck) -> Back to the Basics!
GetBytesTotal() Not Working With Screen Based Development
Hi to you all,
When I create a new (empty) form based application and retrieve the "getBytesTotal()" value on the "master" or "application" form, it returns a file size of 101689 bytes! The file size of the actual swf is just 28 kb.
Why does the getBytesTotal function return a value of almost 100 kB for some empty screens? Or do I need to preload screens with an other function?
For your convenience I uploaded the fla to test:
http://www.web-exxes.nl/ultrashock/preloadscreen.fla
Thank you in advance,
Steven van Rij
Loaded - OnLoad - GetBytesLoaded Not Working
I've tried this several ways and I'm not finding any success!
I'm creating an exe & buring it to a CD w/ an autostart .inf. All the mp3's are pulled in & mapped via an xml. The audio is skipping in places.
I'd LIKE to wait until the audio has loaded until I start playing it. I was thinking that streaming was my problem and _soundbuftime value settings only made it worse....
// CODE -------------------------------------------------------
// xml file is loaded above this - I haven't included that code
narrationSnd = newSlideNode.attributes.NARRSND;
createEmptyMovieClip("audioClip", 1);
narrSnd = new Sound(eval("audioClip"));
narrSnd.loadSound(narrationSnd, false);
if (narrSnd.loaded == false){
for (i=0;1<10;i++){
progress_bar._visible = true;
narrSnd.start();
}
}
else
{
progress_bar._visible = false;
narrSnd.start();
}
//------------------------------
When I trace the narrSnd.loaded out it's undefined, narrSnd.getBytesLoaded always equals narrSnd.getBytesTotal!! It looks like it's loading the sound but it randomly stutters & skips. Anyone have problems with this or might have something else I could try?
GetBytesLoaded In Eval Script Not Working - Advanced
I am loading loads of external swfs one after another into target clips in the root called "screen1", "screen2" etc. The instance name of the chosen target is stored in the string variable 'screen'.
To save download, I have put a single loader(_root.loader) for these swfs in the _root that calls them.
From the swf I am loading I initialise it thus:
_root.loader.totalK=this.getBytesTotal();
_root.loader.loadedK=this.getBytesLoaded();
if(_root.loader.loadedK <_root.loader.totalK){
//
loaderX=eval("_root."+_root.screen+"._x")+18;
loaderY=eval("_root."+_root.screen+"._y")+186;
_root.loader._x=loaderX;
_root.loader._y=loaderY;
_root.loader.gotoAndPlay(2);
}
All this works fine, the problem is the following line in the _root.loader itself:
loadedK=eval("_root."+_root.screen+".getBytesLoade d()");
It doesn't seem to execute the getBytesLoaded function, so the all crucial:
if(loadedK<totalK){
//keep playing loop
}else{
//exit loop and play the loaded movie
}
doesn't work. Anyone any ideas as to why?
many thanks
blipstation
Swf File Size Different Than GetBytestotal ?
hello
i have built a preloader for my flash file (the swf file size is 135k) when i use the getBytestotal(); it says it is 246k. i am totaly confused by this and am now wondering how big my file is can anyone shed any light.
thanks
adam
Checking For File Using GetBytesTotal();
I have been trying to get my code to see if a jpg file exists. However, the code below does not work because if the file isn't there, my output window just says Error opening URL. Any suggestions for checking for file existence? I would like to use an if() statement after checking for a file, so that if the file doesn't exist, load this file instead.
var imagebytes:Number = getBytesTotal (path);
if (imagebytes < 1) {
imagenum = 1;
}
GetBytesTotal() Is + ASP File.Size - WHY?
I'm trying to build a multiple preloader, so I need to know the size of all files I'll be preloading.... but...
it seems getBytesTotal() from flash is not correct...
does anybody know something about it?
ASP CODE (the same size as windows)
Code:
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fileq = fs.GetFile(Server.MapPath(arquivo))
Response.Write(fileq.Size)
GetBytesTotal On Loading Jpg ?
Hi people!!!
i am working on a photo gallery where a movieclips replace themselves with a jpg found on a server. an mc named 'pic001' uses contains a movie clip named 'picture'. i use a loadMovie command to replace 'picture' with a file named 'pic001.jpg'. this works fine.
trick is, some of the photos are large and i would like to have a simple loader sho up until the jpg is entirely loaded. i first managed this by creating a library of swf files (each with their own loader) that work fine, but i wanted to take advantage of the killer new feature, so i don't have to go through the extra step of compiling a .swf file for each image...
when i use the command 'picture.getBytesLoaded()' it only returns the ORIGINAL value for the picture MC (which contains nothing other than a rectangle use to determine placement). is there a way to determine the size of the actual .jpg as it is being loaded?
thanks in advance for any help you may be able to provide...
theoceanfrog
GetBytesLoaded Of External Css File?
I have come to the shocking reality (hope I am wrong) that we can NOT track the bytes loaded of a TextField.StyleSheet object (?). The question is - is there a work around? I mean, what if my css file is larger than usual, I find this surprising, I must be missing something.
I am creating a master preloader for everything (the root, swfs, xml, jpg, and css files)in the fla and using classes to import multiple files - xml, jpegs, etc. I started the process with the xml files, and was moving on to replicate the process I created for the other file types and BAM! Css/TextFiels.StyleSheet work differently than every other type of external media ! Not happy and need some... help or workaround please
tom
[Q] How Reliable Is It To Check The File Existence With The GetBytesTotal()?
Just out of curiosity...
How reliable is it to check the file existence with the getBytesTotal() function returning -1???
For example...
PHP Code:
this.loader_mc.loadMovie("blahblah.jpg");
this.onEnterFrame = function ()
{
if (this.loader_mc.getBytesTotal() == -1)
{
delete this.onEnterFrame;
trace("File does not exist!!!");
}
else
{
// your normal loader routine here...
}
}
So far, it looks like the above routine detects the file existence, but I want to hear from somebody else on this...
Thank you...
Loading External SWF - Incorrect GetBytesTotal?
Loading external SWF - incorrect getBytesTotal??
Hi, I've posted this question a couple times now, but no one has responded to my posts. I'm really desperate for help, so if any one had ideas please let me know!
I am loading external SWF into empty movie clips. I want to create a preloader that stops the movie until the SWF have loaded for all buttons
I want to do like this site http://minhlong.com
Thanks for your help!!
GetBytesTotal() From An Externally Loading Picture
Hello,
I'm using this code to load a .jpg into a movieclip with the instance name picholder
Code:
_root.picholder.loadMovie("pic.jpg");
How do I get getBytesTotal() or getBytesLoaded() to work with this picture? I've tried to get the total and loaded this way:
Code:
_root.picholder.getBytesLoaded()
But it doesn't seem to work
Loading External SWF - Incorrect GetBytesTotal?
Loading external SWF - incorrect getBytesTotal??
Hi, I've posted this question a couple times now, but no one has responded to my posts. I'm really desperate for help, so if any one had ideas please let me know!
I am loading external SWF into empty movie clips. I want to create a preloader that stops the movie until the SWF have loaded for all buttons
I want to do like this site http://minhlong.com
Thanks for your help!!
Preloading External SWF File ( GetBytesLoaded
Hi there,
I have two SWF file ( FILE_1.SWF & FILE_2.SWF )
I am going to put my preloading section to FILE_1.SWF file, and it will load FILE_2.SWF file.
I know I can use loadmovie AS to handle it.
.....HOWEVER.....
I would like to show the getBytesLoaded & getBytesTotal information in FILE_1.SWF ( can getBytesLoaded & getBytesTotal get the EXTERNAL SWF size? )
************************************************** *
Possiblly, u will ask for WHY use FILE_1.SWF to load FILE_2.SWF? Here is the answer....
my FILE_2.SWF about 4MB!!!! ( I tried to add the proloading section in it directlly. However, when try to load it. it will show the preloading after 1min!!!!!!!! )
So...
I am going to splite the FILE_2.SWF to 2 parts ( PRELOADING SWF and MAIN SWF )
Cheers
Loading An External .swf And Using GetBytesLoaded
I'm loading an external clip into a blank mc like:
Code:
loadMovie("pic1.swf", pic1holder);
now i want to use getBytesLoaded on this external clip.
Code:
bytesLoaded = pic1holder.getBytesLoaded();
but this doesn't seem to work... any ideas?
GetBytesLoaded When Loading An Image?
Hey,
i am trying to get number of bytes loaded when loading an image. Is there way to retrieve information like that?
Here is what i am trying to do:
myMc.loadMovie("picture.jpg");
// i need to see how much of an image is loaded
Please let me know if you have any ideas. Thanks
GetBytesLoaded When Loading Swf From Another Server
Hi!
I have a pretty annoying problem. I have a main-flash on one
server and I'm loading another swf into that file from another server.
It has to be done this way for bandwidth purposes.
This works just fine. I have a "System.security.allowDomain("*");" in
the file and a "crossdomain.xml" on the server as well just to be safe.
The problem is that "getBytesLoaded()" & "getBytesTotal()" returns
undefined until it's 100% loaded. The file is pretty large and I really
would like to have a neat percent-loader.
Does anyone have a solution or a workaround to this problem?
Thanks.
Loading External Jpges - Incorrect GetBytesTotal?
Hi, I've posted this question a couple times now, but no one has responded to my posts. I'm really desperate for help, so if any one had ideas please let me know!
I am loading external jpegs into empty movie clips. I want to create a preloader that stops the movie until the jpegs have loaded.
I am using the code below, however the movie just seems to play anyway, even though the images have not actually loaded. It seems as if its not calculating the correct bytesTotal.
Is there something I am missing?
(I am using Flash MX 2004, but I want to export for Flash 6 Player).
Thanks for your help!!
Code:
stop();
loadMovie("photos/galleries/gal1_01a.jpg", "a");
loadMovie("photos/galleries/gal1_01b.jpg", "b");
loadMovie("photos/galleries/gal1_01c.jpg", "c");
myInterval = setInterval(preloader, 100);
bytesA = a.getBytesTotal();
bytesB = b.getBytesTotal();
bytesC = c.getBytesTotal();
totalBytes = (bytesA + bytesB + bytesC);
loadedA = a.getBytesLoaded();
loadedB = b.getBytesLoaded();
loadedC = c.getBytesLoaded();
loadedBytes = (loadedA + loadedB + loadedC);
function preloader() {
if (loadedBytes>=totalBytes && totalBytes>0) {
play();
clearInterval(myInterval);
} else {
stop();
}
}
GetBytesLoaded When Loading Image ONLINE
Is it true that a
myMovieClip.loadMovie("myImage.jpg")
...wont return
myMovieClip.getBytesLoaded() (!NAN)
...until
myMovieClip.getBytesLoaded() == myMovieClip.getBytesTotal()
?
I dont get ANY DATA from
myMovieClip.getBytesLoaded()
...until the image is loaded completely.
I used a script @
http://www.flashguru.co.uk/000044.php
..but i wont help either !
This always works OFFLINE but NEVER ONLINE !
Thanks so much for any hints on this topic !!!
cEdRik!
Loading External Swfs And Getting Getbytesloaded()
Since components load in the first frame,
I want to create an swf (ie construct)
In the first frame of construct i want to load pgloader.swf in an mc called 'load' (my loading program)
and on load, i want it to load program.swf into another mc called 'program'
now, i want my loading program in 'load' to be able to get information like.. getBytesLoaded and getBytesTotal from _level0.program ?? How do you do this, im used to loading load programs into the swf i want to load and thenjsut doing _root.getBytesTotal...
Im just not sure how todo this, i know that using _level0.program.getBytesTotal doesn't work, (i tried it)
[F8] Loading SWF - Getbytesloaded, Drivin' Me Nuts...
Please let me beg forgiveness if this is answered somewhere, but i've been looking at numerous threads and testing multiple examples from flashkit and can't seem to figure this one out.
Basically I'm loading a SWF file but it won't report the bytes loaded or increase the percentage bar until the file is fully loaded. The Plan.SWF that is loading (see attachments) is a file taken from AutoCAD, imported to Illustrator and saved from CS3 to a SWF file. I've tried putting that swf file into Flash but get a "not enough stack space" error so i'm resigned to using the SWF as it comes from Illustrator.
Here's a copy of the code in the first frame of LoadPlan.fla that was basically copied from another Flashkit example (or maybe it was Flash Help). Sorry, i've tried too many things to remember...
var barWidth:Number = 200;
var barHeight:Number = 6;
this.createEmptyMovieClip("pBar_mc",9999);
var bar:MovieClip = pBar_mc.createEmptyMovieClip("bar_mc", 10);
bar.beginFill(0xFF0000,100);
bar.moveTo(0,0);
bar.lineTo(barWidth,0);
bar.lineTo(barWidth,barHeight);
bar.lineTo(0,barHeight);
bar.lineTo(0,0);
bar.endFill();
bar._xscale = 0;
var stroke:MovieClip = pBar_mc.createEmptyMovieClip("stroke_mc", 20);
stroke.lineStyle(0,0x000000);
stroke.moveTo(0,0);
stroke.lineTo(barWidth,0);
stroke.lineTo(barWidth,barHeight);
stroke.lineTo(0,barHeight);
stroke.lineTo(0,0);
pBar_mc.createTextField("label_txt",30,0,barHeight ,100,21);
pBar_mc.label_txt.autoSize = "left";
pBar_mc.label_txt.selectable = false;
pBar_mc._x = (Stage.width-pBar_mc._width)/2;
pBar_mc._y = (Stage.height-pBar_mc._height)/2;
this.createEmptyMovieClip("my_plan",100);
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("Plan.swf",my_plan);
pBar_mc.onEnterFrame = function() {
var pctLoaded:Number = Math.floor(my_plan.getBytesLoaded()/my_plan.getBytesTotal()*100);
if (!isNaN(pctLoaded)) {
pBar_mc.bar_mc._xscale = pctLoaded;
pBar_mc.label_txt.text = pctLoaded+"% loaded";
trace (pBar_mc.label_txt.text);
if (pctLoaded>=100) {
pBar_mc.onEnterFrame = undefined;
}
}
};
Thanks for any help!!!
GetBytesLoaded Loading Image Into Dynamic MovieClip
Hi,
I'm creating a movieClip dynamically and loading an image into it. This works fine, although I'd like to monitor the loading of the image but whenever I try "getBytesLoaded" or "getBytesTotal" it returns the value "0". This is an excerpt of my code:
code:
this.main_mc.createEmptyMovieClip("imgClip",5);
this.main_mc["imgClip"].loadMovie("pic.jpg");
this.main_mc["imgClip"].onEnterFrame = function() {
trace(this.getBytesLoaded());
}
If anyone has any ideas about this, I would really appreciate any help.
Thanks!
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!
|