20006 hyundai elantra

hello everyone, my girl friends car is doing something interesting, well it started off the car died while she was driving home from work, so I towed it with my truck home, the alternator had went bad so i changed that, but no here is where the problem comes in that i cant figure out, the car will start and run for about 3 miles than it will die in and out, loose power but not kill the engine and the check engine light flashes, and now the radio does not work at all (at idle or running) and the head lights are dim.
i tested the battery, it was with in ranges for cold starting, output while the car is on and a few other thing, i re checked my belts and they are all tight and in the correct alignment

any ideas would help me out.
if you need more details please ask away sorry if that was a long story

A check engine light flashing means there is a misfire, loosing power like you describe can be caused by a clogged fuel filter. Can you get the codes read? Most auto parts stores will read them for free if you can get it there. But do not drive if the CEL continues to flash.

no I already tried with my tester, the connection in the car is broken (the plastic portion of it) to mis shaped and doesnt fit in the tester

and also the check engine light doesn’t come on at an idle, just when the car starts to loose power.

A check engine light flashing, means that serious damage can be done if you continue to let the engine run. There may already be serious damage. I would get it towed to a competent mechanic who can fix the diagnostic plug and read the codes.
When the ECM detects that there is a serious problem the ECM puts the engine into a limp mode so you can get off the road and park in a safe area. Not so that you can continue to force the car farther.

Yosemite

i don’t think the light is flashing like a mayday, the light flashes in sync with the car starting to die out and regain, when the car is driving normally there is no light on, just when teh car starts stalling the light comes on, than goes right back off when the car regains some strength, this all happens with on 5-10 seconds, i start pulling over and than all of a sudden the car is normal again.

and all these problems didn’t start until I replaced the alternator,

I’d try replacing the crankshaft position sensor:

“the radio does not work and the head lights are dim.” That indicates a battery or cable or alternator problem. this may be causing the other problems, as the engine computer doesn’t run well on low voltage.

Get a meter and check the voltages. Battery should be 12.6 volts with the engine off, and about 14-15 volts when the engine is running. Check across the battery and also at the ends of the cables.

However there may be other problems as well.

Make sure the battery voltages as described by poster BillRussel above are correct, and the connections are clean and tight. Next, try driving the car with just a single key in the ignition lock, no dangling keychain or do-dads.