Jump to content
Search Community

warning: assignment within conditional. did you mean == instead of =?

Chousse test
Moderator Tag

Recommended Posts

Hello,

 

'warning: assignment within conditional. did you mean == instead of =?' in tweenplugin.as and other file at different Line

 

I've this strange error since I update my greensock package to v12 with the $99 club subscription ...

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.

 

I just did a very simple test:

 

import com.greensock.*;
import com.greensock.plugins.TweenPlugin;
import com.greensock.plugins.AutoAlphaPlugin;


TweenPlugin.activate([AutoAlphaPlugin]);
TweenLite.to(needle, 4, {autoAlpha:0});


trace(TweenLite.version) //12.1.2

In Flash my ActionScript Settings > errors I have both Strict Mode and Warnings Mode activated.

 

I can't seem to replicate the errors. 

 

Can you provide more details on the error. Does it report a line number where the error is in TweenPlugin.as?

 

Also I searched the TweenPlugin.as source code for =? and there were no occurrences.

 

Feel free to zip your fla and actionscript code (no members plugins) and we will give them a look. The simpler the better.

 

 

 

 

Link to comment
Share on other sites

I work with flashdevelop compiler (with SWC created w Flash) not with Flash IDE
since v12 I have these warning :

D:\ClassesAs3\com\greensock\TweenMax.as:1633:Warning: Assignment within conditional.  Did you mean == instead of =?
				if (allTrue || (tween is SimpleTimeline) || ((isDC = (TweenLite(tween).target == TweenLite(tween).vars.onComplete)) && delayedCalls) || (tweens && !isDC)) {
				                                              ^

D:\ClassesAs3\com\greensock\plugins\BezierPlugin.as:247:Warning: Assignment within conditional.  Did you mean == instead of =?
			if ((ar = this._autoRotate)) {
			     ^

D:\ClassesAs3\com\greensock\plugins\TweenPlugin.as:158:Warning: Assignment within conditional.  Did you mean == instead of =?
			if (end != null && (c = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - start : int(end.charAt(0)+"1") * Number(end.substr(2)))) {
			                    ^

D:\ClassesAs3\com\greensock\plugins\TweenPlugin.as:285:Warning: Assignment within conditional.  Did you mean == instead of =?
					if ((pt._prev = pt2 ? pt2._prev : last)) {
					     ^

D:\ClassesAs3\com\greensock\plugins\TweenPlugin.as:290:Warning: Assignment within conditional.  Did you mean == instead of =?
					if ((pt._next = pt2)) {
					     ^
Link to comment
Share on other sites

  • 1 year later...

I was getting these warnings with Adobe's latest ASC 2.0 compiler. You can fix it like this

 

Change:

if (allTrue || (tween is SimpleTimeline) || ((isDC = (TweenLite(tween).target == TweenLite(tween).vars.onComplete)) && delayedCalls) || (tweens && !isDC)) {

To:

isDC = (TweenLite(tween).target;

if (allTrue || (tween is SimpleTimeline) || ((isDC == TweenLite(tween).vars.onComplete)) && delayedCalls) || (tweens && !isDC)) {

 

Chnage:

if ((ar = this._autoRotate)) {

To:

ar = this._autoRotate;

if (ar) {

 

Change:
if (end != null && (c = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - start : int(end.charAt(0)+"1") * Number(end.substr(2)))) {
To:
var c:Number  = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - start : int(end.charAt(0)+"1") * Number(end.substr(2));
if (end != null && c) {
 
Change:
if ((pt._prev = pt2 ? pt2._prev : last)) {
To:
pt._prev = pt2;
if ((pt._prev ? pt2._prev : last)) {
 
Change:
if ((pt._next = pt2)) {
To:
pt._next = pt2;
if (pt._next) {
 
Obviously you'll have to reapply these fixes every time you update your Greensock library. Alternatively you can go back to using the old Flex compiler. 
Link to comment
Share on other sites

No, you definitely should NOT make those changes. That would break the logic. Those "warnings" are just warnings, not errors. The GreenSock code is entirely valid and is written that way on purpose, for performance reasons. Those are supposed to be assignments, not conditionals. You should just ignore the warnings (it's pretty annoying that the compiler insists on spitting those 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.
×
×
  • Create New...