WARNING: Text field variable names are not supported in ActionScript 3.0

ActionScript WARNING: Text field variable names are not supported in ActionScript 3.0. The variable ‘btnName’ used for an unnamed text field will not be exported.

ActionScript Warning Description:

So I was going back to restructure a project that I had done in AS2 and a previous version of Flash.  I thought I had converted all of the old AS2 code, and components, and naming conventions, etc… when this error popped up.  The error made a lot of sense until I went to fix it.  The image below is what I saw when I went to the place that I thought be the resolution to this error.

Text Field Variable Names not displaying in CS4/

Text Field Variable Names not displaying in CS4/AS3

Flex / Flash Text Field  Variable Warning Fix:
I searched around at other buttons and tried to find something else that might have been it even though I knew that this was the correct text field.  The way to solve this is to revert back to AS2 in your publish settings ( FILE >> PUBLISH SETTINGS >> SCRIPT drop down) and then go back to the text field in question and you will be able to delete the variable name. Don’t forge to return to ActionScript 3.0 after you delete the variable name.

File >> Publish Settings >> Script Option

File >> Publish Settings >> Script Option

and with this option selected you can then delete the variable name as shown below.

Text Field Variable Names not displaying in AS2

Text Field Variable Names not displaying in AS2

This should help you resolve Flex / Flash Text Field Variable Warning

Thanks and as always Happy Flashing

Curtis J. Morley

AS3 Error #1126: Function does not have a body.

ActionScript Error 1126: Function does not have a body.

ActionScript Error 1126 Description:

I got this error from one of my UVU students code.  And as promised in honor of her I am thusly naming AS3 Error 1126 the Erin Johnson Error.  This error is given, in this case, because a semicolon is used instead of a colon after the parenthesis.  A semicolon in the ActionScript language is equivalent to a period in the English Language which means that if Flash sees the semicolon it says to the compiler finish this line of code and move on. The colon on hte other hand is used to say what Type something is or in the examples below what “Type” of data will be returned when the function is called. In the example below we don’t want to return a type so we use :void (notice the colon). This should help solve AS3 Error 1126.

 

Flex / Flash Error #1126 Fix:
Replace the semicolon with a colon.

Bad Code 1:

function someFunc(event:MouseEvent);void
{
doSomething();
}

Good Code 1:

function someFunc(event:MouseEvent):void
{
doSomething();
}

Related Errors:

ActionScript Error 1084: Syntax error: expecting colon before leftparen. This error is a psuedo error in this case because once AS3 Error 1126 is reslved this error will also disappear.

This should help you resolve Flex / Flash Error #1126

Thanks and as always Happy Flashing

Curtis J. Morley

Speaking at FITC Amsterdam

Flooglytics = Flash + Google Analytics
I am excited to say that I will be speaking in Amsterdam in February at FITC AmsterdamFITC has always been one of the leading Flash conferences and happening around the globe.  This will be the full length version that goes more in-depth into techniques and case studies.

What:

Flash and Google Analytics = FLOOGLYTICS
Flash has always been considered the ugly step sister in the world of SEO and Analytics. Well now Flash takes “Center Stage”. Using Google Analytics data can be extracted from Flash that could never be pulled from HTML. This session will explore the ins-and-outs of how to setup Google Analytics to work most effectively with your Flash files and how to set up Flash to work most effectively with your Google Analytics account. Go beyond just seeing what users did. See what users meant to do or even wanted to do but didn’t. The most important part of the equation is how to refine this gold that Flash and Google Analytics provide. Walk away from this session armed with the tools you need to implement Floogylitics and make your site effective. Combine this session with the MAX session announcing the new developments at Google Analytics and you will be miles ahead of the competition.

Where: FITC Amsterdam

When: Feb 22-24, 2009

Links:

Curtis Morley Speaker Bio at FITC Amsterdam
Flooglytics – Flash and Google Analytics Summary

So sign up for and I will see you in the The Netherlands.

Happy Flashing,

Curtis J. Morley

Speaking at Adobe MAX – Flooglytics

Flooglytics = Flash + Google Analytics

I am excited to say that I will be speaking one month from today at the FITC Unconference at Adobe MAXFITC has always been one of the leading Flash conferences and has expanded to locations all around the globe.

What:

Flash and Google Analytics = FLOOGLYTICS
Flash has always been considered the ugly step sister in the world of SEO and Analytics. Well now Flash takes “Center Stage”. Using Google Analytics data can be extracted from Flash that could never be pulled from HTML. This session will explore the ins-and-outs of how to setup Google Analytics to work most effectively with your Flash files and how to set up Flash to work most effectively with your Google Analytics account. Go beyond just seeing what users did. See what users meant to do or even wanted to do but didn’t. The most important part of the equation is how to refine this gold that Flash and Google Analytics provide. Walk away from this session armed with the tools you need to implement Floogylitics and make your site effective. Combine this session with the MAX session announcing the new developments at Google Analytics and you will be miles ahead of the competition.

Where: FITC Unconference at Adobe MAX in San Francisco

When: November 19th 3:30 P.M.

So sign up for MAX and I will see you on Wednesday.

Happy Flashing,

Curtis J. Morley

ActionScript Error 1184: Incompatible default value of type int where String is expected.

ActionScript Error 1184: Incompatible default value of type int where String is expected.

ActionScript Error 1184 Description:
This error is quite simple.  It just says that you have the wrong type of data in your parameter initializer.  Or in other words you tried to assign a string where you typed the parameter as a uint.

Flex / Flash Error #1184 Fix:
Match the parameter type to the proper data type.

Bad Code 1:

bob(someValue:uint = “Happy”)
{
trace(someValue);//error 1184
}

Good Code 1:

bob(someValue:uint = 5)
{
trace(someValue);//output 5
}

Related Errors:

AS3 Error 1047

This should help you resolve Flex / Flash Error #1184

Thanks and as always Happy Flashing

Curtis J. Morley

ActionScript Error 1047: Parameter initializer unknown or is not a compile-time constant.

ActionScript Error 1047: Parameter initializer unknown or is not a compile-time constant.ActionScript Error 1047

Description:
Let’s break down ActionScript Error 1047 into it’s various parts.

  1. Parameter = The variable inside the parenthesis of a function
  2. Initializer = An initial value set on the parameter inside the parenthesis
  3. Compile-time Constant = Something Flash knows the value of without evaluating

So long story short – you are trying to assign a value to a parameter that has to be evaluated.  Still don’t know what I mean?  Check the code examples.

This is actually a really great feature of AS3.  Say for example you have an event listener that calls a function.  You also want to call this same function without the event. Unless you pass a value in you will get AS3 Error 1136.  AS3 allows you to set the Event parameter to null and therefore accept a call to that function without passing in a parameter.  function myUtilFunc( e:Event = null);

You can initialize and function with any Compile time constant for example a string like “Happy”, a constant like null or an int like 5 but you can not throw in anything that needs to be evaluated like a variable, math operation, an in-line array like [a,b,c] or date.

Flex / Flash Error #1047 Fix:
Remove any variable data and use only constants in the initializer such as Strings, Numbers, Null, etc…

Bad Code:

var init:String = “Happy”
function bob(someValue:String = init){
trace(someValue);
}

Good Code:

function bob(someValue:String = “Happy”){
trace(someValue);
}

or

function multiFunction(e:Event = null){
//doSomething;
}

Related Errors:

AS3 Error 1184

This should help you resolve Flex / Flash Error #1047

Thanks and as always Happy Flashing

Curtis J. Morley

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

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+”]”);

}