erhabi Posted June 26, 2010 Share Posted June 26, 2010 Hello, I have a nested mc called 'mcfishers' that resides inside 'stagemc1', residing on the main stage. So in order to imagine, the mc is built like this : stagemc1 + mcfishers Now i saw this somewhere and the code i have tried to write in order to tween the nested mc is something like this: var mc:MovieClip = stagemc1.mcfishers; TweenLite.to(mc, 0.5, {autoAlpha:1, ease:Sine.easeIn}); Now, I'm not an expert on as3, just a designer that is still learning, but when the code runs nothing happens.. the mc remains as is on the stage with no errors whatsoever while compiled. I tried looking into the documentation too but i could not find any reference to using TweenLite with nested mcs. Help, anyone? Thanks. Link to comment Share on other sites More sharing options...
GreenSock Posted June 26, 2010 Share Posted June 26, 2010 It sounds like there may be some other problem in your file. Did you import the TweenLite class and did you activate the autoAlpha plugin? Try adding trace(mc) right before your tween to make sure it's not null. As long as your stagemc1 is a MovieClip and you imported the necessary classes and activated the AutoAlphaPlugin, that code should work but just so you know, you can also look for the child of a particular DisplayObjectContainer (like a MovieClip) by name with the getChildByName() method, like stagemc1.getChildByName("mcfishers"). If you're still having trouble, please post a simple FLA that demonstrates the issue. Link to comment Share on other sites More sharing options...
erhabi Posted June 26, 2010 Author Share Posted June 26, 2010 thanks for the tip! it seems adding in the plugins line alongwith the activation seems to work just fine! import com.greensock.plugins.*; TweenPlugin.activate([AutoAlphaPlugin]); i am loving this engine more and more! thanks guys for such a great work on the engine, really. its awesome!!! Link to comment Share on other sites More sharing options...
erhabi Posted June 26, 2010 Author Share Posted June 26, 2010 Also, in your opinion, do you think using the 'getChildByName' method is more reliable than the above ? I mean, whats the difference between the two ? Just curious. Thanks Link to comment Share on other sites More sharing options...
GreenSock Posted June 28, 2010 Share Posted June 28, 2010 Also, in your opinion, do you think using the 'getChildByName' method is more reliable than the above ?I mean, whats the difference between the two ? Just curious. The benefit of using getChildByName() is that it works on all DisplayObjectContainers, meaning Sprites too. MovieClips are special because the MovieClip class is "dynamic" meaning you can add properties/methods at runtime whereas most other classes (like Sprite) will throw compiler errors if you tried to do that. This code will work for a MovieClip but fail for a Sprite: myObject.randomVariable = "whatever"; So yes, technically using getChildByName() is preferred although it's not "wrong" to do it the way you did as long as your object is a MovieClip. Link to comment Share on other sites More sharing options...
erhabi Posted June 29, 2010 Author Share Posted June 29, 2010 great! thanks for the explanation, i am just in love with TweenLite and TimelineLite!! Link to comment Share on other sites More sharing options...
erhabi Posted June 29, 2010 Author Share Posted June 29, 2010 great! thanks for the explanation, i am just in love with TweenLite and TimelineLite!! 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