There will be an "X" factor in every project. You will always hit a roadblock that you didnt see in your planning stage, assuming you bothered to plan. These things happen, but how you deal with them is key.

Show no Fear!
Show no fear in the face of adversity. Such a nobel thought and holds true in your industry. Lets face it people, its just code! Code is nothing more than instructions made of words and symbols. Honestly, it isnt rocket science, so dont be afraid of it. You're bigger than it is!

Face First into a Wall
When you hit that roadblock take this advice. Step away from the computer and go scream at the wall. Get your frustrations out before you try to solve it. Once you have all that out of your system, come back and try to solve it. You'll find it easier once you have all that out of your system. Guess I'm the Doctor Phil of Developement, but seriously, it helps a lot. No roadblock is perminent.

Dont be afriad to ask for help. You've been looking at your code for hours, days, or even weeks. Its all become one long line to you, but to someone else, the problem may be obvous. With that said, ask for help. There is no shame in it. I have 2 or 3 other Flash developers that I always ask to look at my code and tell me where the problem is. Use your resources. Its a lot like raising a child, yea I've done that twice already. Dont be afraid to leave your baby project in the hands of a friend for a few hours while you go out to play. Trust me, it helps more than you'll ever realize. Plus, they're friends of yours, they're going to hear you complain about it anyway, so let them see the actual problem.

Leave Time
Always leave yourself plenty of time on a project. When that "X" factor shows itself, you dont want to be caught behind a deadline that fast approaches. If you have a project that you think will take you 3 weeks, tell them 4 weeks. Leave yourself enough time to address the "X" factors that come up. This prevents you from stressing yourself out and looking incompetent. Nothing worse than missing a deadline, especially when freelancing. This one is just so simple, leave extra time for issues and breathers.