Jump to content
Search Community

Call a var in a Tween [SOLVED]

domi85 test
Moderator Tag

Recommended Posts

Hello,

I would like to make a tween with a dynamic name of movie clip, but i dont know well how to call that name of clip :

 

var actif:String = "PEDApres";

teleactif = function() {
actif = "PEDAtele";
}

clipPEDAmenu.boutonPEDAtele.onRelease = function() {
var clipactif:String = "clip".concat(actif);
trace(clipactif);
TweenLite.to(clipactif, 2, {autoAlpha:0});
TweenLite.to(clipPEDAtele,2 , {autoAlpha:100, delay:1, onStart:teleactif });
}

 

The name of the movieclip is created, and traced, but the Tween with clipactif doesnt work (the second one with clipPEDAtele does). How can i write that ? Does it need a $ or something ?

 

Thanks !

Link to comment
Share on other sites

thank you for your answer, but im afraid it works even worse...

with my code, it traced clipactif as "clipPEDAtele", what i wanted, but now with this code it says undefined...

I think the non-working line is :

TweenLite.to(clipactif, 2, {autoAlpha:0});

Written like this, will it recognize it has to replace the var clipactif by its value ? It seems not to... is there another way to write it ?

Thanks again

Link to comment
Share on other sites

Then it's a scope issue - where exactly is your MovieClip located? In clipPEDAmenu or in boutonPEDAtele? It would be much easier to troubleshoot this if you posted a simple FLA that demonstrates the issue very clearly. The simpler the better. (don't forget to zip your file before posting).

 

If your clip is in clipPEDAmenu, I believe you'd have to do:

var clipactif:MovieClip= this._parent["clip" + actif];

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