Share Posted December 17, 2010 This is a bit trivial but I'm wondering what's going on. Basically, I'm using a SWFLoader to load swfs and preloading them with this: function progressHandler(event:LoaderEvent):void { preloader_mc.visible = true; TweenLite.to(preloader_mc, .5, {y:280,alpha:1, ease:Sine.easeOut}); var percent:Number = event.target.progress; preloader_mc.progressBar_mc.text = String(Math.floor(percent * 100)); if (preloader_mc.progressBar_mc.text == "100") { TweenLite.to(preloader_mc, .5, {y:270,alpha:0, ease:Sine.easeOut}); preloader_mc.visible = false; } } Everything works fine except I noticed the count will always stop at 99 before fading out. What am I missing here? thanks! Link to comment Share on other sites More sharing options...
Share Posted December 17, 2010 I see a few problems: 1) You're using Math.floor() on your percent which always rounds down. So Math.floor(99.99999999) would be 99. Obviously it hits 100 at some point (because you said it does eventually go away), so the problem isn't related to SWFLoader. You could use Math.round() instead, but that would make the value hit 100 a little bit early (99.5 and above). 2) You set the preloader_mc.visible = false immediately after you create your tween which means that as soon as the value hits 100, you're making it invisible (that explains why you never see it) but also it doesn't allow it to fade out gradually. You'll never see the tween. It would be better to use autoAlpha which automatically toggles visible to false once alpha hits 0. TweenLite.to(preloader_mc, .5, {y:270, autoAlpha:0, ease:Sine.easeOut}); Just don't forget to activate() the AutoAlphaPlugin (see the Plugin Explorer for details/code). Link to comment Share on other sites More sharing options...
Author Share Posted December 17, 2010 That did it! Thank you! I had initially tried Math.round but wasn't seeing a change... but I still assumed the problem was in the count for some reason. The autoAlpha plugin worked like a charm. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now