If you let me know exactly what model of laptop you have, I can give you more concrete information, but I do know a bit from what you've told us.
Depending on what type of BIOS you have, - . . . beep code refers to bad memory, bad video memory, or video adapter failure. That diagnosis based on the symptoms seems critical, but I would guess that something either got too hot and needed to cool down or some component got worked loose inside the system.
I'd let the laptop sit to cool down for a while and try again. If the same problem happens again, you might need to have the system opened up to check for loose components.