01.03.09
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 colon in the ActionScript language is equivalent to a period in the English Language and so the
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
phihochzwei said,
January 15, 2009 at 3:35 pm
Hi Curtis,
would it be okay for you, if we translate your error list texts into german and use it on our user group? Because I think they are very helpful, but unfortunately only for those who speak english
Kind regards,
Jens
Erin said,
January 15, 2009 at 10:39 pm
Yay! My shift key bows humbly.
Christopher J. Rock said,
February 9, 2009 at 12:55 pm
Not to be picky, but you’ve got colons and semicolons reversed there. It’s the semicolon that as3 likes and the colon it don’t.
By the way, you’re sites come in plenty handy on my projects. Thanks!
Christopher J. Rock said,
February 23, 2009 at 6:53 pm
Oh, I just saw I was thinking of a different error. I thought this was the semicolon at the end of a line.
Just saw the example. If that was there before, I didn’t notice it.