Jump to content
Search Community

Referencing Tweens in Flex [SOLVED]

sevmusic test
Moderator Tag

Recommended Posts

I was not able to get the following to work in Flex:

TweenLite.to(mc,1, { x:100});

For some reason it doesn't see the '.to' as a function in Tweenlite.

 

What does work is:

 

private var myTween:TweenLite;
myTween = new TweenLite(mc, 1, { x:100 });

The problem is if I want to keep that animation dynamic and constantly working in a situation like:

 

function enterFrame(e:Event):void{
myTween = new TweenLite(e.target, 1, { x:mouseX });
}

myTween keeps getting refreshed and renewed obviously creating more and more of the instance and also causes odd behavior with the target in question.

 

How do I reference myTween and still be able to control its properties after its already been initated?

 

Thanks in advanced.

Link to comment
Share on other sites

Wasn't it just a typo? You typed "Tweenlite" instead of "TweenLite" (upper case "L"). I can't imagine why TweenLite.to() wouldn't work.

 

By the way, if you want to have an object tween to the mouse position and you don't want to keep refreshing the tween (so that the duration remains fixed), I'd recommend looking into the "dynamicProps" plugin. There's an interactive demo in the Plugin Explorer that does exactly that. (the plugin is only for Club GreenSock members though)

 

You might also want to check out v11: http://blog.greensock.com/v11beta/

Link to comment
Share on other sites

You are correct. It in fact does work.

 

I can't explain why I couldn't use the Tween.to method now. But the error in Flex I was getting said that TweenLite couldn't use the 'to' method.

 

Then again I was called on the typo in my original post "Tweenlite" quite possibly that was the reaon.

 

*smacks himself in the head*

 

-max

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