Jump to content
Search Community

Quick looping question

vdubplate test
Moderator Tag

Recommended Posts

I have a simple tween that I want to loop in AS2. Can someone give me a hand in figuring this out?

This is what i have tried:

 

import com.greensock.*;

TweenLite.to(mc, 14.75, {_x:156, _y:343, loop:true});

 

import com.greensock.*;

TweenLite.to(mc, 1, {_x:156, _y:343, repeat:true});

 

No luck!

 

Thanks in advance

Link to comment
Share on other sites

The "repeat" special property is only available in TweenMax, not TweenLite. So either switch to TweenMax or just use an onComplete to restart() the TweenLite.

 

import com.greensock.*;
TweenMax.to(mc, 1, {_x:156, _y:343, repeat:-1});
//--OR--
import com.greensock.*;
var myTween:TweenLite = new TweenLite(mc, 1, {_x:156, _y:343, onComplete:repeatTween});
function repeatTween():Void {
   myTween.restart();
}

Link to comment
Share on other sites

So if i was going to use tween max how could I loop infinately?

 

import com.greensock.*;

TweenMax.to(mc, 14.75, {_x:156, _y:343, loop:true}); ?

 

also is the a way so specify the level of the tween?

im having some issues with other elements falling below my tweened objects.

I know thats a noob question. I'm kind of learning as im going.

 

Thanks for your help.

Link to comment
Share on other sites

So if i was going to use tween max how could I loop infinately?

 

That's what the first line did in my code sample - you set the repeat value to -1 if you want it to repeat infinitely. Otherwise, you set repeat to the number of times you want it to repeat (repeat:2 would repeat twice, etc.).

 

also is the a way so specify the level of the tween?

im having some issues with other elements falling below my tweened objects.

I know thats a noob question. I'm kind of learning as im going.

 

Tweens don't have levels. You need to manage the stacking order of your MovieClips on your own - that's not really a tweening issue.

 

Good luck.

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