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