How to embed flex swf into flash

Hello,

I have written an xmpp chat client in flex. It works fine. My goal is to embed the swf file into flash CS4. But when i do that with Loader class in AS3 , some of my buttons in my flex swf throws null pointer exception. The code i used to embed the flex swf into flash is below

var loader = new Loader();
loader.load(new URLRequest("flex.swf"));
stage.addChild(loader);