AS3 Error #1051: Return value must be undefined.

Posted in Flash at 6:10 am by Curtis J. Morley

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


  1. Nail said,

    March 31, 2009 at 2:45 pm

    Thanks for taking the time to post this. It helped me in figuring out why I was getting this error.

  2. David said,

    August 27, 2009 at 2:23 pm

    Thanks! If only Adobe had explained this so simply in their manual it would have saved me a great deal of headaches. Be well

  3. Carlos said,

    June 17, 2010 at 2:31 pm


    Just awesome thank you very much!


  4. Stefan said,

    December 19, 2011 at 6:00 am

    Thanks! Worked for us. Stupid error, great solution!

Leave a Comment