Updated info on ActionScript 3 Warning #3590

Updated info on AS3 Warning #3590

I added some data to ActionScript Warning #3590

Go check it out.  For anyone transitioning from AS2 to AS3 this will be very helpful.

Happy Flashing,

Curtis J. Morley

Flex 2/ Flash CS3 Error #3590

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