Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-23-2003, 03:17 AM   #1
Ericinho
Registered User
 
Join Date: Sep 2002
Location: Pays-Bas
Posts: 196
Unhappy On the verge of tears: why doesn't this preloader work (Cyan, Billy, Fafie, anybody?)

Since my previous preload antics left everybody puzzled, i thought I'd try a different approach and started messing with the xscale principle...

But it won't work... it -snip- won't work...

The preloader (also the one in the previous thread) works as follows:

- onRelease set var containing the to be loaded SWF +
- gotoAndPlay the cover-over animation which contains also the loadMovie action + the loadBar (frame 15)
- Arrives at frame 15, and loadMovie the swf in the var
- Frame 1 of the external SWF contains the preload script and it tells the _root.cover.loadBar part to move accordingly to the amount of bytes loaded / or in this case it tells the _root.cover.loadBar.bar to xscale accordingly to the amount of bytes loaded/100
- when finished loading the external SWF preload script tells _root.cover to play the Open part... and to itself to gotoAndPlay frame 3...

But it doesn't work... sigh
It %$#$@$@$ doesn't work... sob

Why... why not?

It seems to hang on the open part (that's frame 16 of the cover)

Code:

onClipEvent (load) {
// get total bytes
// we put this in a load event because we only need to get total bytes once
tkb = _root.content.getBytesTotal();
}

onClipEvent (enterFrame) {
// calculating bar lenght
scale = ((_root.content.getBytesLoaded()/tkb)*100);
// setting the progress bar lenght
_root.cover.loadBar.bar._xscale = scale;
// Check if it's loaded and do whatever after
if (scale == 100) {
_root.content.gotoAndPlay(3);
_root.cover.gotoAndPlay("open");
}
}

The source...

http://www.e-llumination.net/actions...loadxscale.zip


Your help (with this or the other thread) would be much appreciated (some encouraging words as well)...
Ericinho is offline   Reply With Quote
Old 07-23-2003, 04:55 AM   #2
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,858
Default

by just looking @ ur code i would guess:
becuase tkb is a local variable in the onLoad event handler so its not availible onEnterFrame
change to a this.tkb instead
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 07-23-2003, 05:17 AM   #3
ghost23
nu' mal ganz ruhig ...
 
Join Date: Oct 2002
Posts: 36
Default

hello,

if the script is on frame one of the external swf, does onClipEvent(load) really fire? I always thought, it only fires, when the whole movieclip is loaded. but that would be too late, right?

why don't you put the preloader script in the main movie?
ghost23 is offline   Reply With Quote
Old 07-23-2003, 06:58 AM   #4
Ericinho
Registered User
 
Join Date: Sep 2002
Location: Pays-Bas
Posts: 196
Default

Hangalot - no, unfortunately it didn't work (neither changing this to _root and even _root.content)... but it seemed plausible anyway... thanks nevertheless...

Ghost23 - well, this entire script in combination with the cover animation was done with the help from Actionscript's own Billy T. He suggested this way and I felt in no position to argue with him


However, I am now thinking of indeed creating a function which I can use for all preloaders (so I would put it on the bar in _root.cover.loadBar.bar), but it would need to work as well with the cover animation and the current way with the Vars... and ofcourse work regardless of which SWF needs to be loaded into the content placeholder.

But i have no idea how to do that, so suggestions are much appreciated
Ericinho is offline   Reply With Quote
Old 07-23-2003, 07:55 AM   #5
ghost23
nu' mal ganz ruhig ...
 
Join Date: Oct 2002
Posts: 36
Default

hi,

i am actually also working on a preloader.

i wrote a class, like
_global.thePreloader = function() {}

and attached all necessary function to it with
thePreloader.prototype.somefunction = function() {}

That way you can produce many instances of your preloader for everything.

The main thing with preloading is, that you need to watch the loading preogress over a certain period of time, actually until it is finished
instead of creating a frame-based loop with frame scripts, use setInterval(). The rest is actually the same as you did right now.

hope, this gives you a basic idea to continue
ghost23 is offline   Reply With Quote
Old 07-25-2003, 06:37 AM   #6
Ericinho
Registered User
 
Join Date: Sep 2002
Location: Pays-Bas
Posts: 196
Default

thanks, though it would complicate things even more

i think I got the preloader thing partly fixed (see my Question Smoooth Preloader Tut thread)... but not quite...


And also about preloading 'behind the scene' some additional SWF's I am still not clear...
Ericinho is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:22 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.