Residence permit in barcelona

hi there, please help me with your advise.
I intend to come and settle to Barcelona sometime next year (now I'm learning spanish) and I wonder if I have to go and ask for a residence permit wright away.
because it might take a while until I will find a job.
in order to apply for a residence permit (even temporary) I have to show a work contract.
is it legal to stay more than 3 months without working? hope not...but I don't want to get in any trouble.
do I have to take regular flyghts bucharest - barcelona? anyway - there is no visa...

please let me now...

many thanks
raluca

These look like questions for your local Spanish Embassy....are you a citizen of a member state of the EU?

hi, thanks for your reply.
yes, is a member of UE. so you're suggesting I should as at the embassy of Spain in my country.
maybe I should.
many thanks.
raluca