Jump to content
Search Community

TimeLineLite sequencing functions via loop [SOLVED]

swiftmend test
Moderator Tag

Recommended Posts

Hi,

 

I'm building an application that is going to require a large amount of variables passed to it, roughly 70-80 tweens per part of the "game" over a minute or two.

 

I'd obviously like to not have to hand code in each tween as they will vary depending the games level.

 

What i'm trying to build is a timelinlite function that takes an array of Strings and spits it into functions to fire at a set time, baically one each second after each other.

 

this is what I've got:

 

What it should be doing is adding a tween that calls the function Step with the array data sequentially. so it should be basically calling

 

timeline.append(TweenLite.to(this, 1, {onComplete: Step, onCompleteParams: ["L"] }))

timeline.append(TweenLite.to(this, 1, {onComplete: Step, onCompleteParams: ["R"] }))

Etc

 

However it's just throwing an error, am I misusing this function?

 

private var Steps:Array;  
private var timeline:TimelineMax;  

public function DancePlay(SongName:String)
	{
		switch (SongName)
		{
			case "Goldfish":
				Steps = new Array("L", "R", "L", "L", "R")

				var i:int = 0
				while (i < Steps.length) {
					timeline.append(TweenLite.to(this, 1, {onComplete: Step, onCompleteParams: [steps[i]] }))
					i++
				}

				break;
			case "OtherSongs":
//Will have a different array depending on song
				break;

		}

	}

	public function Step(DanceStep:String):void
	{
		switch (DanceStep)
		{
			case "L":
				//Plays this step
				break;
			case "LTC":
//Plays this step
				break;
			case "LT":
//Plays this step
				break;
		}

	}

Link to comment
Share on other sites

Sorry for wasting your time,

 

Of course I did, haha, sorry.

 

Still so amazed at what can be done with this stuff, happy to be a paying customer of this code backed by excellent support!

 

Ah well, at least the code on how to do this stuff adds to the forums search engine. :)

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