PDA

View Full Version : check my jpg loading please!


free mojo
01-25-2004, 06:33 AM
I searched the forums and found a post and found this code, from a tutorial on loading external swf's. I have changed it so that it , hopefully shows the status with a my general loader from the site i'm building, and the bytes loaded and percent. Here:

onClipEvent (enterFrame) {
_parent.total_bytes = getBytesTotal();
_parent.loaded_bytes = getBytesLoaded();
_parent.percent_done = int((_parent.loaded_bytes/_parent.total_bytes)*100);
_root.loader.loadBar.gotoAndStop(_parent.percent_d one);
if (_parent.loaded_bytes == _parent.total_bytes) {
set(cont._alpha, 100);
}
}


Thats on the container clip "cont" and on the first frame of the movie is the loadMovie action.


In the post it mentions that the Poster couldn't see it animate when she uploaded it but it appeared to work. something to do with Temp internet files.
I think i have the same problem.
Could u check this link and tell me if it seems to be loading and calculating correctly, i think the preloader bar seems to start at 100% then go to 1 through to 100% for some reason too:

load jpg (http://www.freemojo.co.uk/latest_load_jpg.html)

Warrior
01-25-2004, 08:08 AM
It loaded fine for me. It showed 0 % and not 100 straight away. Try this code as the above one may run you into trouble in the future.
onClipEvent (enterFrame) {
_parent.total_bytes = _parent.getBytesTotal();
_parent.loaded_bytes = _parent.getBytesLoaded();
_parent.percent_done = int((_parent.loaded_bytes/_parent.total_bytes)*100);
_root.loader.loadBar.gotoAndStop(_parent.percent_d one);
if (_parent.loaded_bytes == _parent.total_bytes) {
set(cont._alpha, 100);
}
}

free mojo
01-25-2004, 08:15 AM
Thanks alot Warrior, i'll substitute codes. Did the load bar(load line?!?!) animate fine too? I'm thinking of just stripping the preloader to just the progress bar as thats what the other preloaders on my site are like. Anyway thanks a lot.

Cheers

Warrior
01-25-2004, 08:24 AM
The load bar that says on top "loading menu" loaded fine and very fast because the file is very small. If you're gonna strip it, then add some text to show how much is loaded as this adds more flavor to the preloader. If you want any help with a preloader just ask me :)

free mojo
01-25-2004, 08:36 AM
Thanks, thats a good sign. Well do u reckon that same preloader with just the percentage loaded would be informative enough?
If so what would i change of the code if i deleted the text fields with bytesLoaded and bytesTotal from my stage?
I've actually got a bit of time to work on my site at the moment so it'd be good to get to grips with that problemo.

Thanks mate

Warrior
01-25-2004, 08:49 AM
Well do u reckon that same preloader with just the percentage loaded would be informative enough? yeah it would.

[qoute]If so what would i change of the code if i deleted the text fields with bytesLoaded and bytesTotal from my stage?[/quote] You can have only the percentage and the loading bar like this;

24% Complete -- and count upwards until 100%

or

84% Complete -- and count downwards to 0% like a timer but in percentage.

free mojo
01-25-2004, 09:16 AM
Right thanks, so if i stick with the 1% upto 100% like the uploaded to my site, were would my code change, would i just remove the _parent part of the _parent.total_bytes and the loaded bytes one, but leave the % thing alone. Then the variables would be set to perform the loading sum but not be visible? and i would delete those 2 textfields like i said before?
would that work Warrior?


thanks again for the reply

Warrior
01-25-2004, 09:25 AM
Don't remove the _parent.total_bytes and the loaded bytes one from the code but just delete those 2 textfields and leave the percent text field.

free mojo
01-25-2004, 09:41 AM
Ah, i did that first but it seemed to stop anything going on, but i couldn't have been sure it must have been the image loading particularly fast, same reason i needed to check it before.
Thanks a lot warrior.

Also i might be using dynamically loading text with html formatting for my news section. (or php, see side-server forum)

I don't want to use device fonts, but i thought it was the only option when loading text into a dynamic textfield. How do i embed a font that i want to use from the .txt file? Do i do it in the flash movie, or is it a HTML tag added to the txt file. Thanks again.
I've got that preloader in the bag now thanks a lot.

Warrior
01-25-2004, 09:54 AM
Click on text options and look at the bottom left hand corner where it say's "Embed Fonts" and click that.

free mojo
01-25-2004, 10:14 AM
Is that in Flash 5 only , i'm using MX and i can't seem to find a Text Options window ?

Warrior
01-25-2004, 10:29 AM
If you click on the text field and then click on the button "Character" and choose "All Characters".

free mojo
01-25-2004, 10:50 AM
Thanks , i'll put my glasses on next time
cheers