This code moves sprite 2 to a position relative to sprite 4. If sprite 4 is not moving, then sprite 2 will always move to the same position, so it will not appear to move at all.
Perhaps this code makes more sense:
if (_key.keyCode = 124) then sprite(2).locH = sprite(2).locH +25
if (_key.keyCode = 123) then sprite(2).locH = sprite(2).locH -25
Thanks James, I didn't realize that was what i was doing. i feel silly. But a new problem has arisen. I can only move my sprite if it is i click on the sprite in the score. Any reason as to why that's happening?
You need to continually check which keys are down. The enterFrame handler is a good place for this code. Paste the following code in a Behavior script and attach it to your sprite.
property sp -- this sprite
on beginsprite me
sp = sprite(me.spriteNum)
on enterFrame me
if _key.keyPressed(124) then sp.locH = sp.locH + 4
if _key.keyPressed(123) then sp.locH = sp.locH - 4