PDA

View Full Version : Preloader code?


nageekdoog
12-25-2005, 04:15 AM
I haven't figured out how to make a preloader since Flash MX. My MX code didn't work in MX04...and now I have Flash 8 and the same problem is still there. I'm probably just an idiot but if someone could please point me in the direction of a working preloader...they would be an incredible human being.

Thanks in advance...

Flash Gordon
12-25-2005, 04:32 AM
http://actionscript.org/forums/showthread.php3?t=88248
http://actionscript.org/forums/showthread.php3?t=78609
http://actionscript.org/forums/showthread.php3?t=76773
-----------------CROSSPOSTING----------------------
Look, stop being a ......., and use one of the codes that I, oldnewbie, deadbeat, and many other have tried to give you. :(

There is no need for so many new threads started for your same question.

If you can't find a code that works apparently you aren't searching hard enough. You should search as hard for a preloader script as you do a keygen for you Flash apps.

I have nothing more to say in this thread.

nageekdoog
12-25-2005, 04:57 AM
First off, I told you multiple times that getBytesLoaded() and getBytesTotal() DON'T WORK FOR ME. That's why I've posted so many times. They don't work. I don't know why. If they did, I wouldn't have posted. I'm not a moron so stop treating me like one. Maybe if someone would answer my question you could shut me up. I've searched for days on end trying to find code that doesn't involve those two functions. I've found only a few things and they aren't as good. They're cookie cutter solutions and I don't wanna use 'em because they suck. Stop thinking you're so elite because you have 2K+ posts. This kind of thing should be a community and not a bunch of forum whores trying to be better than everyone.

oldnewbie
12-25-2005, 03:21 PM
Calm down boys!

And Nageekdoog, just attach some example .fla you're trying to preload, and one of us will try to help you out!

There no reason the mentioned codes shouldn't work for you... I've been using them from MX only, and they still work fine on MX2004 and/or Flash 8!

Merry Xmas! ;)

nageekdoog
12-26-2005, 04:50 AM
I appreciate someone being NICE about this dilemma I'm having. I'm not sure why it's not working either. I used this code in MX and it worked fine. It's not any specific file I'm trying to preload...it's all of them. getBytesLoaded() and getBytesTotal() return the same value when they are called. No matter what. As you could probably guess, this doesn't work well for making a percentage based on the two...I don't know...Do you know of anything that would affect those two functions? Could it be because I'm on a Mac or because I have the 'education' versions of flash MX2004 and 8?

Merry Christmas to you as well.

Headshotz
12-27-2005, 11:35 PM
I am on a mac, I have the education version of MX2004 and normal full version of Flash 8, could you post the .fla file you are working off and I will change it :)

Thanks
-Headshotz

J_Miller
12-28-2005, 03:04 AM
Hello...

I use this chunk of code almost daily. Has worked great for me and is really easy to plug in.

Hope it helps......and I also hope this class is available in the version you are using. Im not 100% sure because I use the full retail version of MX Pro and Flash 8




// MOVIE LOADER
var LoaderClass:MovieClipLoader = new MovieClipLoader();
var MovieLoader:Object = new Object();

// MOVIE LOADER VARS
MovieLoader.CurrentListener;

// START MOVIECLIP LOAD
MovieLoader.StartLoad = function(Clip, Target, Handler){

// REMOVE HANDLER
LoaderClass.removeListener(CurrentListener);

// RESET HANDLER
switch(Handler){
case "Default":
trace("Default Handler");
LoaderClass.addListener(this);
this.CurrentListener = this;
break;
default :
trace("Custom Handler");
LoaderClass.addListener(Handler);
this.CurrentListener = Handler;
break;
}
LoaderClass.loadClip(Clip, Target);
}


// DEFAULT HANDLER
MovieLoader.onLoadStart = function(Target_mc:MovieClip) {
trace("Load Started");
}

MovieLoader.onLoadProgress = function(Target_mc:Object, bytesLoaded:Number, bytesTotal:Number) {
totalBytes = Math.round(bytesTotal / 1024);
loadedBytes = Math.round(bytesLoaded / 1024);
percentDone = Math.round((loadedBytes / totalBytes) * 100);
trace("Loading Progress:" + percentDone + "%");
}

MovieLoader.onLoadComplete = function(Target_mc:MovieClip) {
trace("Load Complete");
}

MovieLoader.onLoadError = function(Target_mc:MovieClip, ErrorCode:String) {
trace("ERROR CODE = " + ErrorCode);
trace("MOVIE LOAD FAILED ON CLIP: " + Target_mc);
}




When your ready to load the movie, just use the following syntax:


MovieLoader.StartLoad("yourmovie.swf", "yourmovieclip_mc", "Default")

Headshotz
12-28-2005, 05:16 AM
I think it is just problems with a standard preloader.

nageekdoog
01-13-2006, 03:01 PM
Headshotz, how are you going to change the file I attach? Couldn't you just tell me how to do it? PM me or something? I know for a fact that my getBytesLoaded() and getBytesTotal() functions produce the same value no matter what. I added 7 frames with large images on them to increase file size and the trace still gives the same value for both loaded and total on the first frame. Example of this: http://geocities.com/stripedretrospect/picture3.jpg...I'm totally baffled as to why this is too...

chrisxkelley
01-13-2006, 10:36 PM
are you using the test download in flash?

try exporting the swf, then going to view > download settings, make sure it is set to a slow connection, and then go to view > simulate download.

if you arent doing that and simply exporting the file, of course the bytes loaded will be the same as the total because its on your computer already :p



chris

Headshotz
01-14-2006, 10:25 PM
Yes, local files load instantaneously, unless you use 'simulate download' they will return the same.

vibetribe
01-15-2006, 01:14 AM
Chris, i was thinking the same thing lol

Headshotz
01-15-2006, 04:39 AM
I thought he meant they were always returning the same values, like 2000bytes every time. Not the same values as each other, which makes more sense obviously.

Flash Gordon
01-15-2006, 04:42 AM
I wouldn't worry about it too much. Every 6 weeks or Neekdog starts a thread about preloaders and then yells at anyone who tries to help. He doesn't realize (and never will probably) that there is a different between online an offline.

Headshotz
01-15-2006, 04:48 AM
:eek:

Have to understand that not everyone has an easy time interpreting concepts like this, and different people react differently.

Anyway, I wonder if the original Flash Gordon was a programmer :p

Flash Gordon
01-15-2006, 04:51 AM
:eek:
Have to understand that not everyone has an easy time interpreting concepts like this, and different people react differently.

Anyway, I wonder if the original Flash Gordon was a programmer :p
And not understand concepts is fine, but when you don't follow the advise that people give you, and then yell and them that is another. I'm all for helping....

As the for programmer thing, I don't follow :confused:

Headshotz
01-15-2006, 04:57 AM
Its a joke, judging by your name I thought you would have known the original Flash Gordon cartoons, really old stuff. I was just saying, if the character was secretly a programmer ;)

oldnewbie
01-15-2006, 05:58 AM
Down under humor, I see! :D

Flash Gordon
01-15-2006, 05:58 AM
AH......I missed that. Gotcha.

oldnewbie
01-15-2006, 06:00 AM
Oh! And if you don't get it FG...

Down under -> Autralia -> Headshotz -> humor -> joke!

Flash Gordon
01-15-2006, 06:06 AM
Hey so Headshotz,

Do you know how to Australian kiss?

Headshotz
01-15-2006, 08:21 AM
Down under humor, I see! :D


Haha, it strated in the USA, first it was a comic book, then a movie series, then an animated series :p Haha.



Oh! And if you don't get it FG...

Down under -> Autralia -> Headshotz -> humor -> joke!


Yeah, our toilets spin the other way!



Hey so Headshotz,

Do you know how to Australian kiss?


I dont kiss kangaroos :p

But we do ride kangaroos (which just bounce around the city) to work, if you need to cross water, just jump on a crocodile and off you go! The kids get to school on a giant tumbleweed, we have no roads or grass, its all red dust. ;)

Flash Gordon
01-15-2006, 04:11 PM
Hey so Headshotz,

Do you know how to Australian kiss?

Oldnewbie was close.

It is just like Frech kissing, but down under. :D

chrisxkelley
01-15-2006, 05:13 PM
i think this is the most off topic post ive seen in a while :p

from preloaders to tumbleweeds to... kissing down under:eek: :eek: ?

haha

Flash Gordon
01-15-2006, 05:41 PM
It happens a lot around here.....

L_RZA
01-16-2006, 06:57 PM
I appreciate someone being NICE about this dilemma I'm having. I'm not sure why it's not working either. I used this code in MX and it worked fine. It's not any specific file I'm trying to preload...it's all of them. getBytesLoaded() and getBytesTotal() return the same value when they are called. No matter what. As you could probably guess, this doesn't work well for making a percentage based on the two...I don't know...Do you know of anything that would affect those two functions? Could it be because I'm on a Mac or because I have the 'education' versions of flash MX2004 and 8?
Merry Christmas to you as well.

Hmm, this is a funny ol' thread ..
*nageekdoog: I have read through your posts and comments, and in my opinion youve left out some small info .. what script are you using? 1 or 2 as from my experience the code is quite different ..
Myself Ive never had a problem with preloading, or to the extent that it sounds you have, but it does make me wonder why you would splash out on Flash8 if you dont have the fundamentals of MX sorted - ala preloading?
Anyway, you should be told .. Flash 8 has a very good Preload Class built into it, with detection and all sorts.
If you had done as much research as you admit, you would know this, yes? You should really read the manual, or at least read the help file

NOTE: Preload Classes are built into Flash8

Headshotz
01-17-2006, 08:05 AM
Oldnewbie was close.

It is just like Frech kissing, but down under. :D

Wahahahaha, you got yourself a signature quote.