Ok ... a preloader

So I’ve studied it and no use… so i’m going to ask it out!\rHow to make a preloader that shows \rhow many bytes are loaded\rhow many bytes are left to load\rhow much is loaded in %\rSo …its a newbie question (at least i think that) but how is it done???\r\rOK is it done like this???:\r/bytesloaded only for now…\rI have a dynamic textbox var-named “bs”\ractions:\rbs = _bytesloaded\r\r\ror something how tell me plz…\rand how to tell it that it has to check the third frame’s bytes loaded :rolleyes: \r\rany help would be appreaciated

3rd frame’s bytes?.. hmm not sure about that specificaly…\r\rIn Frame 2\r\rbL=bytesLoaded;\rtB=totalBytes;\rpercentBytes=(tB-bL)/100;\rif (bL!=0&&bL==tB){\r gotoAndPlay(4);\r}\r\rIn Frame 3\r\rgotoAndPlay(2); \r\r\rnotes: “&&” means, both questions must be true for the if to perform it’s stuff.\r"!=" is a statement saying “not equal to.”\r"==" is a statement saying “is equal to”\r\rso \rif(bL!=0&&bL==tB){\r} means:\rif bL is not equal to zero, and if bL is equal to tB, exicute what is in the brackets.

ok so I need textboxes var-named “bL” and “tB” and so on…\rbut shouldn’t it be like this:\r\rbL=_bytesLoaded;\rtB=totalBytes;\rpercentBytes=(tB-bL)/100;\rif (bL!=0&&bL==tB){\rgotoAndPlay(4);\r}\r\rnotice the "" before “bytesLoaded” and “totalBytes”\rshouldn’t it be like this\r_bytesLoaded and _totalBytes\r----\rSo the action\r…\rif (bL!=0&&bL==tB){\rgotoAndPlay(4);\r}\r\r^That is the action to go to frame 4 when it’s loaded\rAm I right?\rBut what about like this if I replace that with:::\r\rbL=bytesLoaded;\rtB=totalBytes;\rpercentBytes=(tB-bL)/100;\rifFrameLoaded(4); {\rgotoAndStop(4);\r}\r\rCould it be like this too???\rcuz that one is easier…

fhds

sorry me bad it is “getBytesLoaded();”\r\r

\rok so I need textboxes var-named “bL” and “tB” and so on…\rbut shouldn’t it be like this:\r\rbL=_bytesLoaded;\rtB=totalBytes;\rpercentBytes=(tB-bL)/100;\rif (bL!=0&&bL==tB){\rgotoAndPlay(4);\r}\r\rnotice the "" before “bytesLoaded” and “totalBytes”\rshouldn’t it be like this\r_bytesLoaded and totalBytes\r
\rYou can name the variables anything you like. I actually suggest something a little more discriptive than bL, but I was going quick. :slight_smile: \rThere is no "
" before the getBytesLoaded or getBytesTotal, as far as I know. My script works without them. You’ll also notice, if your command is correct, it will show up in the action script panel highlighted in blue.\r\r
\rSo the action\r…\rif (bL!=0&&bL==tB){\rgotoAndPlay(4);\r}\r\r^That is the action to go to frame 4 when it’s loaded\rAm I right?\rBut what about like this if I replace that with:::\r\rbL=bytesLoaded;\rtB=totalBytes;\rpercentBytes=(tB-bL)/100;\rifFrameLoaded(4); {\rgotoAndStop(4);\r}\r\rCould it be like this too???\rcuz that one is easier…\r
\rIt looks like that would work. I’ve never tried it. I find that since I’m already using the “bytes” variables, it’s just easier for me to use them again, but you’re welcome to play around with it and see what you can do. The “ifFrameLoaded();” looks like a good command to use if you’re trying to hold up sections of the movie.

Oh and that’s a good catch btw… not many would have asked about the “". If it were bytesLoaded, instead of getBytesLoaded, there probebly would have been a "”. Those are signifiers to show that it’s a property of an object. bytesLoaded, writen that way woud imply to me that the command was a property of the whole movie.

OK thanx man…\rI’ll try them every possible way…

is that right:\rtb = totalBytes;\r\rcuz “totalBytes” won’t turn into blue\r?.?.?.

should it be like that???\rIf I test the movie on my PC\rIt shows me\rin the bytesLoaded textbox= [Type Function]\rin the bytes left to load = 0\rIn the percent done = NaN\rtotalBytes = (nothing)\r\rshould it be like that???

no man… tB is a variable that I’m setting to equal to the totalBytes… tB is not a command… it could just as easily be\r\rbyteTotal=getBytesTotal();

I think I’ve established that already!!!\rOK so \r\rI have 4 dynamic textboxes var-named\r"bloaded" <-- Bytesloaded\r"btotal" <-- Bytestotal\r"bleft" <-- Bytesleft\r"bpercent" <–Bytespercent\r\rthe actions in frame 1:\r\rbloaded = getBytesLoaded;\rbtotal = totalBytes;\rbleft = btotal-bloaded;\rbpercent = (bloaded/btotal)*100;\r\rso!!!\r\rbut When I test the movie on my PC there is text in these texboxes:\rbloaded = [type Function]\rbtotal = <nothing>\rbleft = 0 (<–that should be right)\rbpercent = NaN\r\rSo I understand that if I play it on my machine there’s nothing to load… ok but should it be like this that it shows me these thing in the textboxes???\rof course at the end of the ascript there is the check action and goto\rI also made a 2-frame loop…\rSo…\rShould it be like that?

Try adding “_root.” at the begining of the variable name in the text options… that might help.

Now what do you mean by that?\rare you telling me to make the bloaded var-name to “_root.bloaded”\rwhat’s that good for?

Variables are a little tricky in flash… and truthfuly, Im no master with regards to them… I can say that some if a variable is called in a movie clip, then you must direct any a/s that’s looking for that variable, to the movie clip’s name. “_root” applies the same way, but directs the player’s attention to the main time line from inside a movie clip.\r\rhmm If that doesn’t make sense, just let me know… I’ll try to explain it better.

i understand what does “_root” do… but add it into a var-name… “_rootbLoaded” that doesn’t make any sense to me…

nope that wont do.\rit would be\r_root.bLoaded\ryou’re not adding it to the front of the variable, you’re denoting to the player that this variable called “bLoaded” is located at the “_root” location. The period “.” is vital and is used in the same way in other programing languages like Java Script and CGI protocals, to denote location in an Object Oriented Programing language, or OOP. Some, like Flash 4.0 used “/” slashes to denote locations in a object hierarchy.

I know what is _root and I know how to use it but what is it good for now?\rI have the actionscript and stuff right and all. All I’m asking is that should it be like this: (maybe it should, I dunno)\rThe actionscript is right bt When I ** Tes The Movie ON MY COMPUTER** these things appear in the textboxes (bLoaded,bTotal…)\rI mean A TEXT appears on them. I dunno if that should be like this or not…

I’m sorry… I’m not trying to be frustrating. I’m trying to understand. :slight_smile: \r\rAll I’m saying is, if your imported text works on your local machine, when you test it, but it does not work on a web site, then one of two things are in error in my experience.\r\rEither the .txt document that you are importing the variable data from is not uploaded to the web site along with the swf,\ror\ryour addressing system is not calling to that variable correctly.\r\rAdding “_root” to the beginning of that variable call, is just something to try out. I don’t know what the problem is, so I’m giving you options of things to experiment with. If “_root.” is added to the variable call, and the movie doesn’t work in test mode, then it gives us a clue that the problem does not likely fall into the catagory of an addressing problem.

In my movie adding _root does not change anything. (I’m not even sure if there is something wrong in my movie…)…

Well you’re asking me if it “should be like that”… I’m not sure what your question is then… can you reitterate?