Archive for the 'Compiler Warnings' Category
The type selector ” was not processed, because the type was not used in the application.
The type selector ‘Alert’ was not processed, because the type was not used in the application.
Reason
The compiler is telling you that it can’t find a case where the CSS that you are including inline or in a stylesheet is being used in the application. This is regardless if it will be used at another time. If it’s not being used in the application it’s not included at run time.
To remove this warning add the following line to the command line arguments:
-show-unused-type-selector-warnings=false
Note that “unused’ type selectors aren’t included to keep the file size down.
If you want to include every CSS type selector whether it’s being used or not add the following line to the command line arguments:
-keep-all-type-selectors=true
To change command line arguments in Flash Builder navigate to Properties > Flex Compiler > Additional Compiler Arguments.
No commentsWarning: 3596: Duplicate variable definition.
NA
Problem:
You are using the same variable and Flex/Flash doesn't like it.
Fix:
Change the name of one instance or unnest your loop.
Bad Code:
-
var myArray1:Array = ["a","b","c","d","e"];
-
var myArray2:Array = [myArray1];
-
-
//This first loop goes through the parent array
-
for (var i:int=0; i <myArray2.length; i++) {
-
//this second loop iterates through the nested array
-
for (var i:int=0; i <myArray1.length; i++) {
-
trace(myArray2[i][i]);
-
}
-
}
Good Code:
-
var myArray1:Array = ["a","b","c","d","e"];
-
var myArray2:Array = [myArray1];
-
-
//This first loop goes through the parent array
-
for (var i:int=0; i <myArray2.length; i++) {
-
//this second loop iterates through the nested array
-
for (var j:int=0; j <myArray1.length; j++) {
-
trace(myArray2[i][j]);
-
}
-
}
or
-
var keys:String = "Word";
-
-
for (var i:int=0; i <keys.length; i++) {
-
//Code
-
}
-
-
for (i=0; i <keys.length; i++) {
-
//More Code
-
}
3553: Function value used where type void was expected. Possibly the parentheses () are missing after this function reference.
Description:
This is one of the best descriptions that I have seen for a Flash Error. This Flex/Flash Error is actually just a Flex/ Flash Warning. This error/warning means exactly what it says. You just forgot the parentheses () when you tried to make a method call.
Fix:
Add the Parenthesis
Bad Code:
-
var myTime:Timer = new Timer(1000, 3);
-
myTime.start;
or
-
var myDate:Date = new Date();
-
myDate.getDate;
Good Code:
-
var myTime:Timer = new Timer(1000, 3);
-
myTime.start();
or
-
var myDate:Date = new Date();
-
myDate.getDate();
ActionScript Warning: 3551:
ActionScript Warning: 3551: Appending text to a TextField using += is many times slower than using the TextField.appendText() method.
ActionScript Error Description:
I love this ActionScript Warning. This is not technically an ActionScript Error instead it is a warning that helps you code better. It is very clear and easily deciphered. This states that you should not use the old way to add text to a text field but rather use the new TextField.appendText() method. This improves performance dramatically and will prevent the user from getting the 15 sec. timeout. (Error #1502: A script has executed for longer than the default timeout period of 15 seconds.)
Fix:
Use TextField.appendText() instead of +=.
Bad Code:
-
var something:String = "Happy ";
-
var somethingElse:String = "Birthday";
-
myTF_txt.text = something;
-
myTF_txt.text += somethingElse;
Good Code:
-
var something:String = "Happy ";
-
var somethingElse:String = "Birthday";
-
myTF_txt.text = something;
-
myTF_txt.appendText(somethingElse);
No comments
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");
3607 The definition _ is deprecated and has been replaced by _.
NA
ENTER YOUR SUMMARY, PROBLEM AND SOLUTION HERE
Problem:
ENTER PROBLEM HERE
Solution:
ENTER SOLUTION AND CODE EXAMPLES HERE
3603 The definition _ is deprecated and should no longer be used.
This definition is deprecated and may be removed in the future.
No comments3601 The declared property _ cannot be deleted. To free associated memory, set its value to null.
Delete removes dynamically defined properties from an object. Declared properties of a class can not be deleted, the operation merely fails silently. To free memory associated with this variable, set its value to null instead.
No comments