Learning to code one absolutely will help you with the other. The languages each have a lot of application specific features, but they’re both based on JavaScript.
Actionscript (in my opinion) is more complicated, but you don’t run into the issue of variables not being persistent from frame to frame as in After Effects.
They’re both fun to play with. 🙂
Dan