Jump to content
Search Community

mc blinks on stage before executing tweens

ngrinchenko test
Moderator Tag

Recommended Posts

I nave a seemingly simple code. I checked on a separate file and it works fine. I can not figure out why it would have a bug in the main more complex flash file. The code is located on a labeled section. On that particular label I commented out the rest of the code leaving only this:

 

 

stop();

import com.greensock.*;
import com.greensock.easing.*;

CR_btnGrp.autoAlpha = 0;
TweenMax.from(CR_btnGrp, 1.5, {autoAlpha:0});

 

so this grouped mc called CR_btnGrp would come up at alpha= 100% and then in a split of a second go to alpha= 0% and execute the TweenMax assigned command.

What can I do to make it appear at alpha= 0%?

Link to comment
Share on other sites

Instead of using CR_btnGrp.autoAlpha=0; have you tried just using CR_btnGrp.alpha=0? If CR_btnGrp is the name of your instance (a normal displayObject), I'm pretty sure it wouldn't have a native autoAlpha property.

 

There's also the property {startAt:{alpha:0}} you could add to your TweenMax statement, but I've had mixed results with that sometimes...

 

CR_btnGrp.alpha=0;
TweenMax.from(CR_btnGrp, 1.5, {autoAlpha:0, startAt:{alpha:0}});

 

(I think that's the proper syntax: just going off the top of my head here...)

Link to comment
Share on other sites

Thanks for your reply.

Unfortunately I tried CR_btnGrp.alpha=0; wit no results

{startAt:{alpha:0}} did not seem to work either

The MC CR_btnGrp is comprised by uniting a bunch of buttons mcs, shape and static text fields.

It still works in the outside testing document, where I copy/pasted the whole instance of CR_btnGrp.

What could be wrong while it is in the original document, if I commented out the rest of the code?

Link to comment
Share on other sites

Here's an example that creates an array from the contents of your movieclip, then tweens that array in a totally cool way.

stop();
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.SimpleButton;

var array:Array = new Array();

for (var i:int = 0; i < CR_btnGrp.numChildren; i++)
{
array.push(CR_btnGrp.getChildAt(i));
}

TweenMax.allFrom(array, 2, {autoAlpha:0, y:"-300", rotationY:"-180", rotationX:"-180", ease:Elastic.easeOut}, .05);

Link to comment
Share on other sites

Oh, wow, thats cool, it works..... but with the same glitch.

First the whole

CR_btnGrp

abruptly appears then dissapears without any transition, and then your cool effect works.

 

Cool effect, but still have the same problem of the

CR_btnGrp

making an unscheduled appearance....

Link to comment
Share on other sites

I think the problem is related to a screen update that occurs prior to the tween.

Probably due to playhead movement in your timeline nav.

 

Try adding the MovieClip to the stage dynamically in a function, and include the TweenMax in the function body. No screen update will occur until the function exits.

Not sure how well this will work with timeline navigation.

Link to comment
Share on other sites

It sounds like there's something else going on in your file. Please post a very simple FLA that clearly demonstrates the issue so that we can take a peek.

 

Please take a look at the attached file. I cleared the rest of the file which is not pertaining the described problem. Once the site loads you will see an image collage assembled on the screen. I numbered the images on which I have tried a couple of different things.

Image 1: Has this code executing

TweenMax.from(CR_btnGrp, 1.5, {autoAlpha:0});

It appears to be blinking on the screen and then executing the command.

Image 2: I have tried the following code

IS_btnGrp.alpha = 0;
TweenMax.from(IS_btnGrp, 1.5, {autoAlpha:0});

However this way the entire IS_btnGrp is disaapearing and never comes back from alpha = 0

Image 3: Has slightly different code (to no effect) where I replaced autoAlpha to alpha

IE_btnGrp.alpha = 0;
TweenLite.from(IE_btnGrp, 0.5, {alpha:0});

greesock is being loaded in the frame 7 in the "products" section.

import com.greensock.*;
import com.greensock.easing.*;

 

I made a separate small test file and everything works fine even with one line of code

TweenMax.from(CR_btnGrp, 2.5, {autoAlpha:0});

 

 

OOps, I was given a message that "You are not permitted to upload this kind of file" while trying to upload a 176K .fla file.

What kind of files would you like me to upload so you can take a look?

Link to comment
Share on other sites

You need to zip your file before posting (for security purposes).

 

The reason this doesn't work:

 

IS_btnGrp.alpha = 0;
TweenMax.from(IS_btnGrp, 1.5, {autoAlpha:0});

 

is because you're doing a from() tween which uses the current value as the end value and allows you to define the beginning. So you're setting alpha to 0 before the tween starts and it says "okay, I'm gonna tween alpha from 0 to....let's see what is it?....0. Okay, so tween from 0 to 0" which of course causes alpha to stay at 0 the whole time. :)

 

If you still need some help, please do post your fla after zipping it.

Link to comment
Share on other sites

Makes total sense, however strange. Out of my lack of understanding I used the same erroneous wet up in the test file and it worked just fine. Out of curiosity why did it work? The attached file name is "TestForFade-DEL.fla.zip"

The name of the attached file with major errors which need to be resolved is "acolyte31D_TEST.fla.zip"

 

On that file now is only one image coming up which needs to be clicked, it brings a user to a troubled labeled section where that blinking occurs. To test again it is better to restart the file.

Link to comment
Share on other sites

In the first fla, the reason it "worked" is because you were trying to directly set an "autoAlpha" property on a MovieClip like mc.autoAlpha = 0 but there is no such thing as an autoAlpha property of a MovieClip, so Flash just thinks you're trying to set a variable. It never actually made the alpha 0. autoAlpha is a special property that TweenLite/Max recognizes and handles in a special way.

 

As for your other file, the reason it appears to "flash" is because you did a gotoAndPlay("coolingreflections") where that object is full opacity, and then 9 frames later, you finally run your TweenMax.from() code that hides the object and fades it in. So for those 9 frames, you see the object normally. If you want it to hide right away, make sure you run your ActionScript on that frame where the "coolingreflections" label is.

 

Make sense?

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...