ActionScript 3 Error: 1051: Return value must be undefined.
ActionScript 3 Error #1051 Description:
This error is popped up when you have specified the return type of a function as “void” and then returned something like a String, Number, etc…
Flex / Flash Error #1051 Fix:
If you need to return something from this function then simply specify the return type properly.
Bad Code:
function bob():void
{
return “message”;
}
Good Code:
function bob():String
{
return “message”;
}
Related Errors:
Flash Error 1067 (If you specified a return type of int, uint, Number, Array, Bitmap, etc…)
Flash Warning 3590 (If you specified a return type of Boolean)
Flash Error 1046 (If you specified a return type of Button)
This should help you resolve Flex / Flash Error #1051
Thanks and as always Happy Flashing
Curtis J. Morley
Thanks! Worked for us. Stupid error, great solution!
Hi,
Just awesome thank you very much!
Cheers!
Thanks! If only Adobe had explained this so simply in their manual it would have saved me a great deal of headaches. Be well
Thanks for taking the time to post this. It helped me in figuring out why I was getting this error.