Jump to content
Search Community

Bug when tweening visible

Rabies test
Moderator Tag

Recommended Posts

Strange "bug" going on...

 

Look here: http://sporeproductions.com/temp/IIDEX-widget.html

 

On the "Home" side of the cube, click on "Select Answer" button, then on the answer panel, click on blue close button.

See how the 2 panel movieclips flip and their visible setting turns on/off and the appropriate time to make it look like 1 panel flipping in 3D space?

 

You can even rotate the cube left/right, then come back to that panel and they still flip correctly. But, click the (i) button (upper right corner), then click blue X button to go back. Now try flipping that panel and you'll see that the "visible" property is now being set at the end of the tween instead of the beginning like it originally does.

 

I have one button doing the first flip:

 

TweenLite.to(mcTRIVIA_Q, 0.4, {rotationX:-90, visible:0, ease:Expo.easeIn});
TweenLite.to(mcTRIVIA_A, 0.4, {rotationX:0, visible:1, delay:0.4, ease:Expo.easeOut});

 

And this script is to flip the panels back again:

 

TweenLite.to(mcTRIVIA_A, 0.4, {rotationX:90, visible:0, ease:Expo.easeIn});
TweenLite.to(mcTRIVIA_Q, 0.4, {rotationX:0, visible:1, delay:0.4, ease:Expo.easeOut});

 

What would cause TweenLite to change how it tweens visible ??

Link to comment
Share on other sites

first off, that's a great cube spin and flip-aroo effect that you have there. very cool.

 

being that going from question to answer to question to answer to question works flawlessly, and clicking the "i" button is what messes it all up, I'd start looking at what the i button does

 

does the i button set the visible, alpha or rotationX values of mcTRIVIA_A or mcTRIVIA_B?

 

if so, when you flip from "preferences" back to trivia are both trivia_a and trivia_b set to the exact same rotationX and visible/alpha setting as they were prior to the flip?

 

if pressing i sets the alpha of trivia_a to 0 is it ALSO setting the visible to 0?

 

you need to make sure that when i is pressed, if you are changing visible or alpha of any clips using the visible plugin that BOTH alpha and visible are set to off and then when you close out of preferences BOTH these settings get set back to what they were prior.

 

It appears that the "visible" aspect of the tweens is in fact ending where it should be but not STARTING where it should, which prevents you from seeing the rotation.

 

another guess:

 

the rotation isn't even happening. meaning if for some reason trivia_a already has a rotationX of 0 and you tween it to a rotationX of 0 then there is no where for it to tween to. so you will just see nothing happening and then whammo! visible:1 makes it appear when the tween's duration has expired.

 

THE FIRST THING I WOULD DO TO TEST:

 

take visible out of the occasion ENTIRELY. yeah, your file make look weird but you will at least be able to verify whether or not your clips are spinning in 3d space properly.

 

once you can verify that the animation is happening then add a little bullet proofing to the mix by forcing the tweens to START with the proper visible/alpha/rotationX settings like so:

 

first flip

 

mcTRIVIA_Q.alpha = 1;
mcTRIVIA_Q.visible = true;
mcTRIVIA_Q.rotationX = 0;
mcTRIVIA_A.alpha = 0; 
mcTRIVIA_A.visible = false;
mcTRIVIA_A.rotationX = -90;
TweenLite.to(mcTRIVIA_Q, 0.4, {rotationX:-90, visible:0, ease:Expo.easeIn});
TweenLite.to(mcTRIVIA_A, 0.4, {rotationX:0, visible:1, delay:0.4, ease:Expo.easeOut});

 

second flip

 

mcTRIVIA_A.alpha = 1;
mcTRIVIA_A.visible = true;
mcTRIVIA_A.rotationX = 0;
mcTRIVIA_Q.alpha = 0; 
mcTRIVIA_Q.visible = false;
mcTRIVIA_Q.rotationX = -90;
TweenLite.to(mcTRIVIA_A, 0.4, {rotationX:90, visible:0, ease:Expo.easeIn});
TweenLite.to(mcTRIVIA_Q, 0.4, {rotationX:0, visible:1, delay:0.4, ease:Expo.easeOut});

 

now that I think about it a fromTo tween might do the trick as well.

 

---------------------------

 

my gut feeling is that somehow the starting values of your tweens are getting messed up, and not the end values. that's why i manually threw all those property resets in there.

i haven't quite rationalized though why after you flip a few more times (after returning from preferences)... things don't naturally get themselves worked out.

 

 

 

normally i'd say upload a simplified fla, but in this case it would be pretty difficult to strip that thing down and i imagine the file as it is might be to complicated for anyone to make sense of easily.

 

--------

 

also there is good deal that happens when you go TO preferences and then BACK to trivia that could be causing problems.

 

 

let us know what you find.

Link to comment
Share on other sites

Wow, what an awesome reply! Thank you so much for the troubleshooting steps.

 

PS: *One note: (i) does nothing to the trivia clips, which is part of what baffles me here, but you got me thinking about their states when returning to that "side" of the cube.

PPS: You are right that it's difficult to strip this down. I am new to AS3, and something as simple as just turning off a layer (setting it to Guide) like I used to do in AS2 just breaks everything because of references to missing clips. I really hate that. :cry:

Link to comment
Share on other sites

Well, the workaround was rather simple (and I feel bad about it given your lengthy post to help me). I added an onComplete to to the first tween to trigger the second tween in a seperate function instead of relying on delay. So in that second function I put a mcTRIVIA_Q.visible = true;

 

Works!

Link to comment
Share on other sites

Ha!

 

hey, my reasoning wasn't too far off, but I didn't expect the solution to be that simple:)

 

thanks for posting your results. i'm sure it will help me or someone else in the future.

 

great work.

 

Carl

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...