The code has to be pure HTML. If you look at the code and see "flash" or "javascript" or "script" or "iframe" then those are not allowed due to security concerns.
http://support.wordpress.com/code/
You put code into a text widget http://support.wordpress.com/widgets/text-widget/