Groups | Blog | Home
all groups > flash actionscript > november 2004 >

flash actionscript : preloader/event manager related


vince_p
11/24/2004 10:44:43 PM
I am trying to build a preloader but there is something wrong in my code. I
have a button (preLoad_btn) on the main Timeline on which there is a function
for loading a swf and calculating the preloading process. The function loads
the swf but the preloading process doesn't work. Instead of this process i have
tried to put a trace statement in order to see where i was wrong. When i test
the movie, i then click the preLoad_btn, the swf loads and the getBytesLoaded
method return 0 just one time. So i think that there is a conflict between the
event manager of my button (onRelease) and the event manager (onEnterFrame)
which is calling the trace statement (or the preloading calculation -not shown
in the script above). Could someone confirm this ? And is there a way to nest a
function with its own event manager (an onEnterFrame event) inside another
function like i tried to do ? ps: I cannot use the MovieClipLoader class since
i have to see the preloading process locally (not on a web server) Here is the
code:

preload_btn.onRelease = function(){
myLoad("bigMovie.swf");
};

function myLoad (url) {
createEmptyMovieClip("holder_mc", 5);
_root.holder_mc.loadMovie(url);
holder_mc.onEnterFrame = trace(holder_mc.getBytesLoaded()); // doesn't work :
just return 0 one time (the click on the button)
NSurveyor
11/24/2004 10:49:25 PM
You are not using the onEnterFrame correctly. onEnterFrame is a function. You
are defining it as a trace. SO, this is what you do:
holder_mc.onEnterFrame = function(){trace(holder_mc.getBytesLoaded())};

vince_p
11/24/2004 11:21:20 PM
thanks for your reply. When i encapsulate the trace statement inside a function
like you wrote nothing happens: the trace statement doesn't work. In fact, i
tried it before and i re-tried after i readed your post. I think the problem is
elsewhere: is it possible to nest an onEnterFrame event inside a function
called with an onRelease event ? Have you got any clue ?
NSurveyor
11/24/2004 11:36:49 PM
vince_p
11/25/2004 8:23:07 AM
thanks for your replies Nsurveyor and Newsgroup user. But still doesn't work?
i'm getting crazy. The onEnterframe statement is not working. Is it working on
your computers ? What am i missing? Is it possible to use an onEnterFrame event
like this?
Jeckyl
11/25/2004 10:41:12 AM
preload_btn.onRelease = function() {
myLoad("bigMovie.swf");
};

function myLoad (url) {
createEmptyMovieClip("holder_mc", 5);
_root.holder_mc.loadMovie(url);
_root.holder_mc.onEnterFrame = function () {
trace(_root.holder_mc.getBytesLoaded());
}
}

AddThis Social Bookmark Button