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
Pingback: Bookmarks about Int
Pingback: curtismorley.com » New Info added to AS3 Error 1067
Pingback: curtismorley.com » ActionScript Error #1067 - Implicit coercion of a value of type void to an unrelated type Function.