How to use Timer to exit LoopA,then run LoopB?

I'd go with something like this. I put it in a loop() function for clarity.

constant unsigned long firstLoopLength = 10000;
constant unsigned long secondLoopLength = 5000;

void loop(){
        // loop A
	unsigned long loopStartTime = millis();
	while (millis() - firstLoopLength > loopStartTime){
		// do loop A stuff
	}

        // loop B
	loopStartTime = millis();
	while (millis() - secondLoopLength > loopStartTime){
		// do loop B stuff
	}
}