Have you worked any with iLogic? You can probably use it to create a rule to achieve what you want, and set a trigger for it to run on save.
On the Custom Snippets tab, there are three sample snippets for different types of DWF export. One of those three should at least get you started. They all seem to save as DWF, so I'm not sure how much you would need to change it to get DWFx.