I downloaded your capx. And have modified it. Just so you can see how to do it.
Personally I would consider changing the way you select spells, so you could simply left click to equip it in Q and right click to use W. But anyway, I have added comments to it, so you can see what each thing does.
However here are some further explanation.
1. I made a family that hold your spells, this is simply so you don't have to repeat the code as much. And to difference between the spells, I have just added a variable to the family called spell_nr. that goes from 1 to 3.
2. I have added 3 imagepoints to the spell bar, so each spell can be matched to a imagepoint location when they are swapped. Again this is simply to reduce the amount of code needed.
3. To the two Q and W buttons I have added a variable to hold the nr of the spell that is currently equipped. This is when it is replaced, I can return it to the spell bar, before placing the new one.
4. The Q W where you select which spell to equip, also have a variable called Selected_spell, which hold the Spell_nr that was chosen. This is so it knows which spell it should equip.
https://dl.dropboxusercontent.com/u/109921357/Equippind_and_Disequipping_Test.capx