Jump to content
GreenSock

jefinho

TypeError: Error #1006: value is not a function

Recommended Posts

Hi there,

 

I have a problem with the dynamicProps plugin. When I launch the application, I get an error:

TypeError: Error #1006: value is not a function

at com.greensock.plugins::DynamicPropsPlugin/set changeFactor()

at com.greensock::TweenMax/renderTime()

at com.greensock.core::SimpleTimeline/renderTime()

at com.greensock::TweenLite$/updateAll()

 

This is the part of my code that is causing the problem:

 

private function taskTween():void
	{
		for (var i:uint = 1; i <= 8; i++)
		{
			// 8 mc that each contain 4 elements (m1 till m4) that must be animated (rotate)
			var f:MovieClip = Globals.vars["_family" + i];

			// get the value of rotation for each element out of XML (XML-load-function not added to this example)
			// and put that in a var (r1 till r4).
			var r1:int = this["a" + i + "_p1"];
			var r2:int = this["a" + i + "_p2"];
			var r3:int = this["a" + i + "_p3"];
			var r4:int = this["a" + i + "_p4"];
			trace(i+": r1: "+r1 +" r2: "+ r2 +" r3: "+ r3 +" r4: "+ r4);
			// Now something goes wrong with dynamicProps
			// when I try to animate one (m1) element within a mc (f). 

			var twM1:TweenMax = new TweenMax(f.m1,2,{dynamicProps:{rotation:r1},repeat:0,ease:Linear.easeNone});

			//While this is working fine:
			var twM2:TweenMax = new TweenMax(f.m2,2,{rotation:r2,repeat:0,ease:Linear.easeNone});
			var twM3:TweenMax = new TweenMax(f.m3,2,{rotation:r3,repeat:0,ease:Linear.easeNone});
			var twM4:TweenMax = new TweenMax(f.m4,2,{rotation:r4,repeat:0,ease:Linear.easeNone});

			// I need dynamicProps to work because the rotation will change dynamicly 
		}
	}

 

What am I doing wrong?

Is it because I am trying to tween more than one mc at the time?

 

Thanks!

Jef

Link to comment
Share on other sites

The problem is that the value you're passing to dynamicProps isn't a function. Remember, each dynamicProp must be mapped to a function that returns the dynamic value (number), like this:

 

var twM1:TweenMax = new TweenMax(f.m1, 2, {dynamicProps:{rotation:getR1Rotation}, repeat:0, ease:Linear.easeNone});
function getR1Rotation():Number {
   return this.a1_p1; //or whatever
}

 

Looks like you were feeding an actual number to dynamicProps instead of a function.

Link to comment
Share on other sites

Wups, I forgot to tweak part of the code in the previous post, but just edited it. :)

Link to comment
Share on other sites

Thanks for your advise!

I will try it out.

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