You may not be waiting long enough between 'button presses'. The HT12E always repeats each word packet (address bits + data bits) at least 4 times, even if transmission is only enabled momentarily. If you try to send too fast then some of the 'button presses' will be lost.
At its recommended 3KHz oscillator frequency the HT12E takes about 70ms to send the 4 words, so you need to delay for longer than that (eg. 100ms) between transmissions.
CDMA synchronisation is a deep topic.
A well designed CDMA code will have a noise-like autocorrelation, that is zero for all offsets other than the range +/- 1 chip, where the autocorrelation rises to 1.
So how do you find the code offset?
1) Brute force. There are codes that do this. You simply correlate, sequentially, with all possible offsets, and wait until you get a hit. This can take a long time.
2) Time assisted. The receiver knows about the transmitter's code offsets, and knows the exact time from another source (network sync, GPS, absolute with own reference, delta time since last fix, anyway somehow). This reduces the search time by many orders of magnitude, as there are only a few possible codes, and a restricted range of 'distance to base station time of flight' delays to to search over. If you are interested in IS-95 (Qualcomm) North American system http://users.ece.gatech.edu/yucel/is95.pdf it says in this presentation that it uses GPS to assist sync on the 15 bit M sequence spreading codes.
3) Composite code design. You can make a long code from several shorter sub-codes. This is used by the NASA deep space positioning system as an example. Each short code can be synchronised with a brute force search quite quickly. Then the long code position can be computed from the short positions, see 'chinese remainder theorem' for how this could work. This then gives a very tight estimate for where the long code is, and once acquired, it can stay in track.
Best Answer
The code is statistically random but it is not secret. In fact, it's chosen to not conflict with another code on the same frequency. Both ends know the code--it's part of the notion of "channel number". This code sequence stuff is common and you will find the same thing in GPS, and even modems. Sometimes it is called "scrambling".