Log in

View Full Version : preloader and onMotionFinished problem



Dennis_Gull
06-10-2007, 11:44 PM
hello, I've been working on a site for some time now and I just created a preloader for the swf, at the same time as its preloading the swf will do tween on a object but heres the problem:
When the preloader is done it will jump to the other frame (frame 2) and it wont complete the tween unless you have to load longer then the tween is so I though I would also use an onMotionFinished but it doesnt work, this is how it looks like:


var slide:Tween = new Tween(holder, "_x",Regular.easeOut, 800, Stage.width / 2, 0.5, true);

this.onEnterFrame = function() {
var amount:Number = this.getBytesLoaded() / this.getBytesTotal() * 100;
holder.loader._xscale = amount;
var loader_text = Math.floor(amount);
holder.load_text.text = loader_text + "%";
if(amount == 100) {
slide.onMotionFinished = function() {
this.gotoAndStop(2);
delete this.onEnterFrame;
}
}
}

I cant really figure out how to fix this so would really appreciate if someone could point me to the right direction.

Medyman
06-11-2007, 04:56 AM
1. What is the object that you're trying to tween across the screen? Is a progress bar? If so, post back because there is a much better way to do it than a tween.

2. it should be var slide:Object

Dennis_Gull
06-11-2007, 02:07 PM
yeah its the progress bar but also the background, how come it should be Object and not tween, im fairly new to flash so dont have a lot of experience :)

edit:
I just found out that my tween doesnt work if I use "export frame to classes <the frame after the loading>" which I have to select if I want the loading to work properly.