Unless there are some stipulations in your states' tax laws say otherwise, I don't see why not.
Usually you are taxed, and can get tax goodies, on the income earned while you were a resident of a state. So it would make sense that you could get that deduction if you contribute to a state's 529 while you are a resident, e.g. to contribute to state A's plan after you've established residency in state B.
Read the relevant income tax forms and instructions to confirm.