Jump to content
Search Community

Class and Names - tweening names.

Yes! test
Moderator Tag

Recommended Posts

I think I understand why this is not working. I'm calling the class in myTimeline rather than the name - When I tween my_mc its fine, but I want to load up 13 of the same class across the screen then tween them separately.

This is the error 1120: Access of undefined property chickletMc1.

Link to comment
Share on other sites

Do I need to redefine the name as the class? Here's the code, for some reason it would not post in the above message.

 

for (var i:Number=0; i < 12; i++){
var my_mc = new chicklet();
my_mc.name = "chickletMc"+i;
addChild(my_mc);
}

myTimeline.append( new TweenLite(chickletMc1, 0.4, {y:"+450", alpha:1, ease:Sine.easeInOut}));

Link to comment
Share on other sites

The way you're doing it confuses the compiler - it tries to find a chickletMc1 property and can't, so it throws an error. You're probably used to referring to things in a MovieClip directly like that in AS2, but in AS3 it's a bit different. Just use the getChildByName() method, like:

 

myTimeline.append( new TweenLite(this.getChildByName("chickletMc1"), 0.4, {y:"+450", alpha:1, ease:Sine.easeInOut}));

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