Yeah, there's definitely better ways to do it then that. Probably the best one can be seen in the "Physics - distance joint" example capx.
When you run the example, you'll notice a blue line connecting the C2 logo and the HTML5 thingy; it constantly points from the center of one to the center of the other. Copy the events that control this straight into your own game, so that the blue line connects object1 and object2. If the blue line is overlapping a solid object, or however you want it set up, that means the line of sight is blocked and object1 can't see object2. You can add in a bunch of other conditions like distance or angle to really finetune it, too.
I've used this method pretty extensively, it works great. Let me know if you need any more help with it! <img src="smileys/smiley1.gif" border="0" align="middle" />