PDA

View Full Version : Problem with onEnterFrame or similar



shack
June 7th, 2004, 07:47 AM
Hi people!
I've had some trouble making a preloader for external .jpg files. The problem is in the onEnterFrame, I'll show you some part:

loadjpg = function(mc,jpg) {
mc.onEnterFrame = function() {
trace("lele");
}
}

that is just a part of the hole function, but I think it will be enough. It traces "lele" once, not when mc enters a new frame. I've also tried to call it with different ways like: [mc].onEnterFrame, with (mc) { onEnterFrame() . Does anyone know how it should really be?

Voetsjoeba
June 7th, 2004, 01:24 PM
There's nothing wrong with that code. The problem is probably that you are loading an image into that movieclip mc since the name of the function is loadjpg. When you load something into a movieclip, it's handlers etc get reset to default. So your onEnterFrame is also deleted. Keep this in mind: you can't use the onEnterFrame of the movieclip you are loading something into. I always create a newly created auxiliary movieclip's onEnterFrame, works perfectly.