Okay, i know this is probably a silly question, but were carrier based fighters ever used as a defense during an air attack combined with the use of ship based AA weapons. I mean, i know they probably were, but i just cant find any good literature which says yes or no.
In general, in USN service, the preferred practice was for fighter aircraft to intercept attacking enemy aircraft outside the task force / task group AA envelope. Entering that envelope could have some distinctly unpleasant results. Did fighter pilots chase their quarry into the AA envelope? Certainly, happened often enough to be commented on. At Midway, for an extreme example, the last eight planes launched from Yorktown took off straight into the Japanese incoming torpedo plane attack which was already under AA fire from the ships in the task force, including Yorktown. One, for sure was shot down by friendly fire and the pilot killed, one was probably shot down by friendly fire but the pilot was able to bail out and was later recovered. One other pilot remarked that of the two torpedo planes he engaged in this encounter he was sure he shot down one because all the AA fire seemed to be concentrating on him as he closed on the B5N from astern . . . a 5 in. gun commander as an Ensign before going to flight training in 1940, he was a little critical of the ship-board deflection/lead shooting. The other torpedo plane he engaged he never claimed because he could never tell if it was his fire that brought it down or AA fire from a nearby destroyer as both he and the Japanese B5N went through the AA barrage at about the same moment. A lucky day, he landed on Enterprise with 5 gallons in his tank after the smoke cleared. John Lundstrom's excellent volume "The First Team - Pacific Naval Air Combat from Pearl Harbor to Midway," USNI Press, 1984; covers this event starting around page 400.
As a matter of doctrine, pilots were admonished to remain outside the AA envelope. They were not deliberately vectored into the force AA envelope and were often warned off by their controllers. On board the escorts and carriers, as far as the AA batteries were concerned, in an attack, if it had wings, it was the enemy and was to be fired on. Did the pilots stay out? Mostly, on occasion one might stray in and might even live to tell of it. As the war went on, with the advent of the Kamikaze threat, venturing into the force AA envelope was even more dangerous, especially in the presence of VT fused AA rounds.
The approved solution was for fighters to begin their interceptions as far out from the force as possible (a practice made much easier as radar improved) and once nearing the AA envelope break off and start moving back out away from the force for the next interception.
For the Japanese, fighter-based counter air patrol (CAP) was in fact their force's primary defense against enemy air attack.
Until just after Midway, the Japanese didn't have radar equipped on their ships for the purpose of aircraft detection. Japanese carrier doctrine at that time, as per Parshall and Tully, was to rely first on visual spotters on escorting screen ships (such as destroyers) deployed ahead of the carriers. The spotter ships would lay smoke, blink alerts, and sometimes fire their guns, to get the attention of the nearby carrier's counter-air patrolling aircraft (CAP), who would then know to look for interlopers in that area (spotted again visually).
To make this effective, the carrier's escorts had to be as far from the carrier as was reasonable to operate and still be able to communicate. This of course necessarily meant their anti-aircraft (AA) fire wouldn't be as helpful in fending off attacks way over by their carrier.
Their carrier design also didn't help its own AA, as it tended to give them rather large blind spots. Even worse, their best AA fire control at Midway couldn't really cope with fast-moving dive bombers, and not all of their carriers had the best installed.
Basically, this AA setup was really only capable of taking care of a very few aircraft at a time (preferably slow torpedo bombers), and it was supposed to be be the CAP's job to make sure no more than one or two got through for the AA to worry about.