07.15.08

AS3 Warning: 1102: null used where a int value was expected.

Posted in Error, Error, errors, Flash, Flex at 7:36 am by Curtis J. Morley

ActionScript 3 Warning: 1102: null used where a int value was expected.

ActionScript 3 Warning#1102 Description:
This warning is pretty good at describing what is happening but is needs to add a little to explain why. This error will appear when you try and force a variable to be a certain Type within a predefined function. For example if you have a variable like _minute below

Flex / Flash Warning1102 Fix:
Find where you are using null and make sure that you are using the proper value

Bad Code:

var TargetDate:Date = new Date(_year, _month, _date, _hour, _minute=null);

or

var TargetDate:Date = new Date(_year, _month, _date, _hour, _minute="10");

or

var TargetDate:Date = new Date(_year, _month, _date, _hour, _minute=false);

Good Code:

var TargetDate:Date = new Date(_year, _month, _date, _hour, _minute=10);

Warning:
You will not get this error with the code below even though it seems like the same as the code above. The smart folks at Adobe put in logic that will accommodate for numbers-as-strings and also boolean which will result in the number 0.  The AS3 Warning will will only show when you assign an non-permitted variable within the parameters of a method call. The code below will output a valid date. Direct assignment in quotes will be translated into a valid Number not an int. False shows up as 0 in the date.

var TargetDate:Date = new Date(_year, _month, _date, false, "10");

Related AS3 Error:
AS3 Error 1067

This should help you resolve Flex / Flash Warning #1102

Thanks and as always Happy Flashing

Curtis J. Morley

3 Comments »

  1. curtismorley.com » ActionScript Error #1067 - Implicit coercion of a value of type void to an unrelated type Function. said,

    July 15, 2008 at 11:28 am

    […] Related Error: Flash / Flex Error 1188 AS3 Warning 1102 […]

  2. curtismorley.com » New Info added to AS3 Error 1067 said,

    July 15, 2008 at 11:33 am

    […] It is highly related to AS3 Warning 1102 […]

  3. Bookmarks about Int said,

    January 22, 2009 at 6:45 am

    […] – bookmarked by 3 members originally found by BekoBou on 2008-12-25 AS3 Warning: 1102: null used where a int value was expected. http://curtismorley.com/2008/07/15/as3-warning-1102-null-used-where-a-int-value-was-expected/ – […]

Leave a Comment