They're acting like children.
I don't think it's that simple. If the rioters were genuinely interested in getting a message across to the US and get this movie censored, then why are non-US missions also attacked? I think that, in order to explain these regularly occurring riots, you have to be much more cynical: there are people in these countries (both in and outside government) for whom it is advantageous if their country is in a continuous state of anarchy and they simply use this video (or a cartoon) as an excuse to keep it that way. Some outrage may be genuine (but still wrong), but a lot of it isn't.