Flex / Flash Compiler Error #1023: Incompatible override.

AS3 Compiler Error #1023: Incompatible override.

AS3 Error 1023 Description:

This ActionScript error is the most terse error that AS3 has provided us.  It is nothing like the beautiful description of AS3 Warning 1090

It popped up, rearing it’s ugly head like a teenager on Halloween. In most cases this error has more to do with AS3 Error 1021 than it does with an “Incompatible override”.   The first example below demonstrates this behavior. Example 1 will also give AS3 Error 1021 every time.

The second example is when an “Incompatible override” really is the reason.  Method signatures have to match or you will get this error.  Basically it means that you have not matched everything up properly from the method/Class that you are overriding.  So if you are overriding something that accepts events and you forget to put in events you will get this error.  If you give it a different Type you will get this error. Etc…

Adobe gives a good explanation of my second example.  They say:

“A function marked override must exactly match the parameter and return type declaration of the function it is overriding. It must have the same number of parameters, each of the same type, and declare the same return type. If any of the parameters are optional, that must match as well. Both functions must use the same access specifier (public, private, and so on) or namespace attribute as well.”

Flex / Flash Error #1023 Fix:

Make sure that you do not have duplicate names with an object and a function

or

Match the Method Signature of the soon to be overridden class.

Bad Code 1:

var myArray:Array = [1,2,3];

function myArray () {
}

Good Code 1:

var myArray:Array = [1,2,3];

function myArrayFunction () {
}

Bad Code 2:

override protected function draw(event:Event = null):void

Good Code 2:

override protected function draw(event:Event):void

Related Errors:

AS3 Error 3596
AS3 Error 1021
AS3 Error 1023 (Different error same number)

This should help you resolve Flex / Flash Warning #1023

Thanks and as always Happy Flashing

Curtis J. Morley

AS3 Compiler Error# 1021: Duplicate function definition.

AS3 Compiler Error# 1021: Duplicate function definition..

AS3 Error 1023 Description:

This ActionScript error is the most terse error that AS3 has provided us.  It is nothing like AS3 Warning 1090 It popped up, rearing it’s ugly head like a teenager on Halloween. In most cases this error has more to do with AS3 Error 1021 than it does with an incompatible override.  Sometimes it realy does mean that you have an override that is incompatible but many times it just means that you have a function that is named the same as

Flex / Flash Error #1021 Fix:

Do exactly what the message says use an event listener instead of the onRelease event that was common in AS2.

Bad Code 1:

function bob () {
}

function bob () {
}

Good Code 1:

function bob () {
}

function jim () {
}

Bad Code 2:

var myArray:Array = [1,2,3];

function myArray () {
}

Good Code 2:

var myArray:Array = [1,2,3];

function myArrayFunction () {
}

Related Errors:

AS3 Error 3596
AS3
Compiler Error 1023
AS3 Error 1023 (Different error same number.  This one has nothing to do with error 1021)

This should help you resolve Flex / Flash Warning #1021

Thanks and as always Happy Flashing

Curtis J. Morley

ActionScript Warning 1090: Migration issue: The onRelease event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( ‘click’, callback_handler).

AS3 Warning: 1090: Migration issue: The onRelease event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0.  You must first register this handler for the event using addEventListener ( ‘click’, callback_handler).

AS3 Warning 1090 Description:

So the other day I opened some AS2 files that I use for teaching Flash Arrays at UVU.  I changed a few things in the file and tested my movie.  That is when Warning 1090 popped up and I realized that I had missed a few things.  AS3 Warning1090 is the most comprehensive and complete error message that I have ever encountered in Flash or Flex.  Not only does it give a really clear description but it tells you how to solve the issue.  Kudos Flash programmers/writers.  Jen DeHaan  if this is you – Nice Job!

P.S.  This will also happen with onEnterFrame, onPress, onMouseMove, etc…  I have only included one example here but it applies to all cases.

Flex / Flash Error #1090 Fix:

Do exactly what the message says use an event listener instead of the onRelease event that was common in AS2.

Bad Code:

joinArray_btn.onRelease = function () {
//Do Something
}

Good Code:

joinArray_btn.addEventListener(MouseEvent.CLICK, joinArray);

function joinArray() {
//Do Something
}

Related Errors:

AS3 Warning 1058

This should help you resolve Flex / Flash Warning #1090

Thanks and as always Happy Flashing

Curtis J. Morley

Flex / Flash Error 1042: The this keyword can not be used in static methods. It can only be used in instance methods, function closures, and global code.

ActionScript 3 Error: 1042: The this keyword can not be used in static methods. It can only be used in instance methods, function closures, and global code.ActionScript 3 Error #1042

AS3 Error 1042 Description:

AS3 Error1042 is actually a really helpful error.  It is simple in that it states that you will not be able to access something called “this” at the point in the code you are trying to access it.  In other words, you can’t put “this” directly inside the package or the class.  It can go in any of the functions that are within the Class but no higher.

It makes sense.  If you think about trying to access “this” from inside the package or from inside the class definition then you should understand why.  Packages are used only to show Flash/Flex where to find the code so there is no “this” in a file structure.  Also at the Class definition level this doesn’t exist either because the Class hasn’t yet run the constructor to make a “this”.

Flex / Flash Error #1042 Fix:

Remove the reference to the “this” keyword in your package or Class.

Bad Code:

package com.cjm.teaching{
import flash.display.MovieClip;
trace(this);
public class Ball extends MovieClip {
public function Ball():void {
}
}
}

or

package com.cjm.errors{
import flash.display.MovieClip;
public class MyClass extends MovieClip {
trace(this);
public function MyClass():void {
}
}
}

Good Code:

package com.cjm.errors{
import flash.display.MovieClip;
public class MyClass extends MovieClip {
public function MyClass():void {
trace(this);
}
}
}

Related Errors:

If the reference to “this” is at the package level you will also get AS3 Error 5000

This should help you resolve Flex / Flash Error #1042

Thanks and as always Happy Flashing

Curtis J. Morley

Warning: 1058: Migration issue: The property _root is no longer supported. This property has been removed. The closest equivalent is the Stage, which serves as the root of the ActionScript 3.0 display list..

Warning: 1058: Migration issue: The property _root is no longer supported.  This property has been removed. The closest equivalent is the Stage, which serves as the root of the ActionScript 3.0 display list..

AS3 Warning 1058 Description:

So the other day I opened some AS2 files that I had used for teaching Flash Arrays at UVU.  I changed a few things in the file and tested my movie.  That is when Warning 1058 popped up and I realized that I had missed a few things.  AS3 Warning1058 is one of the most comprehensive and complete error message that I have ever encountered in Flash or Flex.  Not only does it give a really clear description but it tells you how to solve the issue.  Kudos Flash programmers/writers.  Jen DeHaan  if this is you – Nice Job!

P.S.  This AS3 Warning will appear with all properties that use the leading underscore such as _x, _y, _width, _rotation, _alpha, etc…  I have only included one example here but it applies to all cases.

Flex / Flash Error #1058 Fix:

Do exactly what the message says remove the underscore or int he case of the _root property target it reltively with the “this” keyword or replace _root with Stage.

Bad Code:

_root.tenantsList = myTenantsArray.join(delimiter_txt.text);

Good Code:

Stage.tenantsList = myTenantsArray.join(delimiter_txt.text);

or

root.tenantsList = myTenantsArray.join(delimiter_txt.text);

or

this.tenantsList = myTenantsArray.join(delimiter_txt.text);

Related Errors:

AS3 Warning 1090

This should help you resolve Flex / Flash Warning #1058

Thanks and as always Happy Flashing

Curtis J. Morley

Flash Jobs – www.curtismorley.com/jobs

Weekly I get requests for people wanting me to work for them or do Flash side projects.  Because of this I am creating a whole new site specifically for jobs.  I will not post everything that comes to me but I will post those that I feel are appropriate.  

Feel free to send job requests to me and I will gladly post them up as long as they are in the relm of Flash, Flex, ActionScript, AIR, mobile, Web development, Game development, or RIA.

The new section of my site will be at www.curtismorley.com/jobs.  You can also click the link over there -> that says jobs.

The first post is from Targeted Learning.  It is a contract job that involves Flash and SCORM.

Thanks and as always,

Happy Flashing

Curtis J. Morley

AS3 hotkeys reference

Are you looking to speed up your coding in AS3 when you are working in Flash environment?  Here is a list of hotkeys that you can use in your actions Panel or with external .as files.  Just hit the [Esc] key and then individually hit the two keys listed after and Flash will spit out a snippet of code for you.

If you want to add your own Flash Quickeys go into the ActionsPanel.xml file and add a quickey.  For example if I wanted to create a pacakage that contained a class and a constructor then I could create my own quickey to do all of that. or if I just wanted to create a package then I would add id =”package” quickey=”pk” to the line that starts <string name=”package” in a similar fashion as the rest of the line with quickeys.

Flash ActionScript3 HotKeys

AS3 output Quickey
   
trace ( ); [Esc – tr]
break( ); [Esc – br]
case condition : [Esc – ce]
continue; [Esc -co]
default : [Esc -dt]
do { } while ( ); [Esc-do]
} else { [Esc -el]
for ( ) { } [Esc -fr]
for ( ) { } [Esc -fi]
if ( ) { } [Esc -if]
return ( ); [Esc -rt]
switch ( ) { } [Esc -sw]
throw ; [Esc -th]
try { } [Esc – ty]
catch ( ) [Esc -ch]
finally { } [Esc -fy]
” “ [Esc -ev]
while ( ) { } [Esc -wh]
with ( ) { } [Esc -wt]
class { } [Esc -cl]
function ( ) { } [Esc -fn]
var ; [Esc -vr]
// [Esc -//]

As always happy Flashing

Curtis J. Morley

P.S.  Here is the code I used to grab all of the quickeys from the ActionsPanel.xml file.  I love E4X.

var quickeyXML:XML = {I pasted the XML from ActionsPanel.xml here}

for each (var element:XML in quickeyXML..@quickey)

{

trace(“[Esc – “+element+”]”);

}

Heeeee-lariouos – Design Minstrel sings about Flash

Matt Maxwell Sings at Flash ForwardAll right you Flashers. Stop banging your heads because of the latest Flash Error and go spend a little time with Matt Maxwell. Matt understands your pain and even sings about it. Once you hear Matt’s lucid tomes you will be blown away at how well he understands your pain.

Matt recently sang one of his Songs about Flash at Flash Forward to a crowd of raving fans.

This is my favorite:
Flash Song by Matt Maxwell – Long Preloader

Matt is a phenominal designer, Flasher, interactive 3D website creator, and a stinking funny performer.

Check out his stuff:

www.MattMaxwellDesign.com

www.designmnistrel.com

Hopefully this will give you a break from those wicked Flash/Flex/AS3 errors and give you a good laugh.

Happy Flashing,

Curtis J. Morley

Teaching Flash again at UVU

Utah Valley University For everyone that has wanted help with their Flash now is your chance to get it. If you have ever said, “Man! I wish I could just ask Curtis this question in person.” sign up for DGM 2870 at the newest University in the Nation, UVU. The class is going to focus on ActionScript Fundamentals and will have a syllabus that looks something like this. I started teaching over 8 years ago and was the first person to teach Flash in Utah. I spent most of my time teaching at UVU (then UVSC) and had a little stint with SLCC (Salt Lake Community College) and then a few years teaching in the Masters of Information Systems at the Largest Private University in the nation, Brigham Young University.

Flash CS3 IconNow I am back to my roots. I am excited to start teaching College Flash again. I will cover ActionScript Fundamentals using the book by Rich Shupe. Arrays, External AS, functions, conditionals, interactivity, usability, Object Oriented Programming, and mobile will be taught. I will be using GoCourse as my LMS/Content Creation Tool/ Grading system for enhanced learning for my students and easier teaching for me.

Super Smash BrothersThe class is extremely fun. It is also a lot of work but the reward is fantastic. I don’t know if it is quite as fun as Super Smash Brothers Melee Theory and Practice taught by Brian Mazur, Mike Blejer and Quentin Jones at Oberlin College (Don’t believe me? Click the link and scroll to the bottom under “Physical Activities and Games”) they also list Stilting as a 1 credit course.

Stilt JumpingAlthough we wont be walking on stilts or playing Nintendo for 2 hours we will learn how to create kick-butt applications, games, widgets, mobile applications, and websites with ActionScript. So go to UVU.edu and sign up today for the night class (7:30-8:45 p.m.).

Flash Error #1180: Call to a possibly undefined method myCustomClass.

ActionScript 3 Error: 1180: Call to a possibly undefined method CustomClass.

ActionScript 3 Error #1180 Description:

One reason for this this error is because you are using the name of the variable that you are assigning to the Class rather than the Class itself.  Adobe also states that this error will only display when “Strict Mode” is turned on.

Flex / Flash Error #1180 Fix:

Make sure that when you instantiate the Object that you are using the Class name and not the variable name.

Bad Code:

var myCustomClass:CustomClass = new myCustomClass();

Good Code:

var myCustomClass:CustomClass = new CustomClass();

Links:

http://www.flashcomguru.com/index.cfm/2007/4/17/Flex-Builder-2-to-write-AS3-code-for-Flash

This should help you resolve Flex / Flash Error #1180

Thanks and as always Happy Flashing

Curtis J. Morley