The Armbar or Straight Arm Lock from on top of your opponent (which is called the "Mount"), can be tricky to do.
The trick is to:
-put your weight on your hand on a part of their body (sometimes chest, or, if they are turned sideways, on their head.
-lean to the side of rear leg. Really open up your hip of your rear leg, like a butterfly stretch, and lean.
This way, when you swing your other leg around, your hips won't come upwards, off of your opponent. You want to avoid that, because if you create space, you lose a bit of control. In that moment of lost control, they could get up, or slip their arm out.
So, stay in close. Keeping that closeness is probably the most challenging part, so you'll have to drill it for awhile. Try doing it with your opponent turned on their side, first. That way is actually easier, because their position already has you elevated, so you mainly just need to lean to the side to bring your leg over. Get comfortable with this version, first.
Then, try it when they are flat on their back. This is a bit harder, because you have to elevate yourself a little, and that part comes from putting your weight on your hands, on their chest.
This technique is kind of like a yo-yo, in it's process for learning. You can have the theoretical concepts in your head, and visualize it, but you won't actually own the skill until you actually do it, drill it, and readjust your execution each time.
And, of course, once you have mastered it on one side, get it on the other. Sometimes people might be a little too eager to try it on both sides without mastery of one. That is not the most efficient way to learn. It is much better to master it on one side, to the point where you no longer have to think about it, and it becomes a reflex. After that, generally speaking, you''ll be able to make the transference to the other side much easier.