Jump to content
Search Community

TweenLiteVars Problem

qshahzad test
Moderator Tag

Recommended Posts

Hi,

I need some help about following error.

ReferenceError: Error #1037: Cannot assign to a method runBackwards on com.greensock.data.TweenLiteVars.

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

 

 

Here is my code

 

import com.greensock.*;

import com.greensock.loading.*;

import com.greensock.events.LoaderEvent;

import com.greensock.loading.display.*;

import com.greensock.easing.*;

import com.greensock.data.TweenLiteVars;

 

var tvar:TweenLiteVars = new TweenLiteVars();

tvar.prop("x",300);

 

TweenLite.from(mc, 1,tvar);

Link to comment
Share on other sites

Same error here. For the time being, the following should run a 'from' tween without error

 

var tvar:TweenLiteVars = new TweenLiteVars();
tvar.prop("x", 300).runBackwards(true);
TweenLite.to(mc, 1, tvar);

 

**EDIT**

I thought I'd have a look into the greensock code; see what was going on.

The static .from() method is throwing the error at: vars.runBackwards = true; because it's returning the runBackwards() method of the TweenLiteVars object, instead of the runBackwards property of the TweenLiteVars property _vars.

 

Any references to vars in the .from() function will not access vars' properties correctly if vars is not a generic object

 

public static function from(target:Object, duration:Number, vars:Object):TweenLite {
vars.runBackwards = true; // fails here with TweenLiteVars
if (!("immediateRender" in vars)) {
	vars.immediateRender = true;
}
return new TweenLite(target, duration, vars);
}

Changing the from() function in com\greensock\TweenLite.as [line 605] to the following will fix the problem (also present in TweenMax.as [line 821]).

 

public static function from(target:Object, duration:Number, vars:Object):TweenLite {
if (vars.isGSVars) {
	vars = vars.vars;
}
vars.runBackwards = true;
if (!("immediateRender" in vars)) {
	vars.immediateRender = true;
}
return new TweenLite(target, duration, vars);
}

Anyone please feel free to tell me if this is not the most ideal way to fix this. I've been using greensock for a few years now, but this was the first time I've actually looked into this amazing code.

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