drupal_add_js does not add javascript on after_build
#after_build is called every time the form it built. I've used this myself many times to add JS to forms. Most likely you have a flaw in the script or after build function itself, or you are using cached data when creating the script to display.

If you posted your code, we could provide a better answer.