11.14.07

Flex 2/ Flash CS3 Error #3590

Posted in Error, Error, errors, Flash, Flex at 9:37 pm by Curtis J. Morley

Flex 2/ Flash CS3 Warning / Error #3590: String used where a Boolean value was expected. The expression will be type coerced to Boolean.

or

Warning: 3590: int used where a Boolean value was expected. The expression will be type coerced to Boolean.

Description:
This is a ActionScript error is more of a warning than a true AS3 error. It will be displayed in strict mode and simply means that you have quotes around your Boolean value. Even though you may get this AS3 error it won't prevent Flex or Flash from compiling nor ActinoScript code. It will convert it for you though. Thanks Flash for doing that for us.

AS3 Warning #3590 Fix 1:
Make sure that your boolean (true or false is not inside quotes).

Bad Code 1:

myObject.visible = "false";

Good Code 1:

myObject.visible = false;

AS3 Warning #3590 Fix 2:
ActionScript 3 uses true and False rather than 0 and 1 for boolean. Although it does allow 0 to make it through without giving this error.

Bad Code 2:

myObject.visible = 1;

Good Code 2:

myObject.visible = true;

AS3 Warning 3590: Fix #3 - *Warning* This method will solve the problem temporarily and allow you to publish your code BUT it will cause you many headaches later. You will not get any warnings or error messages and this is a bad thing I Promise! If you are going to proceed down this path make sure to recheck these boxes after you are done publishing your one problem movie. With that much said, The way you do this is to turn off Strict (Verbose) Error Messages in your preferences as shown below.

Go to File >> Publish Settings >> Click on the "Flash" tab >> Next to "ActionScript version:" click the "Settings..."

AS3 Error 1118 -Implicit Coercion

AS3 Warning 3590 Fix #4 - In the example below you will see that the function "Return Type" is listed as Boolean when it needs to be listed as String.  To fix this simply change the Return Type to String or return a Boolean value "true" or "false".

Bad Code:

function bob():Boolean
{
return "message";
}

Good Code:

function bob():String
{
return "message";
}

AS3 Warning 3590 is pretty easy and straight forward.

As always - Happy Flashing

4 Comments »

  1. curtismorley.com » Updated info on ActionScript 3 Warning #3590 said,

    May 22, 2008 at 3:42 pm

    […] Updated info on AS3 Warning #3590 […]

  2. curtismorley.com » Search Engine Optimization Example said,

    June 2, 2008 at 4:40 pm

    […] AS3 Warning – #1,2 on Google […]

  3. curtismorley.com » AS3 Error #1051: Return value must be undefined. said,

    August 20, 2008 at 12:46 pm

    […] Error 1067 (If you specified a return type of int, uint, Number, Array, Bitmap, etc…)Flash Warning 3590 (If you specified a return type of Boolean)Flash Error 1046 (If you specified a return type of […]

  4. curtismorley.com » New Example in AS3 Warning 3590 said,

    August 20, 2008 at 1:27 pm

    […] have posted a new example under the ActionScript 3 Warning 3590.  This example addresses fixing an errant Return […]

Leave a Comment