I’m a big fan of keeping MXML files clean by not having any code and style information in them. You can get rid of the style information by using a style sheet. A nice way to get all of your code out of the MXML is by using the code-behind method.
Code-behind encourages developers to build applications with separation of presentation and content in mind. In theory, this would allow a web designer, for example, to focus on the design markup with less potential for disturbing the programming code that drives it.
There is a good article by Aral Balkan at the Adobe Devnet on using the code-behind method with Flex.
Links: