Like all other plants, Venus flytraps harness solar energy through photosynthesis. Unlike other plants, however, Venus flytraps actively trap animal prey. Since they rely on sunlight for energy, they are still considered autotrophs.
A Venus flytrap is a carnivorous autotroph. Unlike heterotrophs, it can harness sunlight for energy. The flies are important but not essential to its survival.
The energy source distinguishes autotrophs from heterotrophs. Most autotrophs use energy from sunlight to make organic compounds from CO2 and H2O through photosynthesis. Some autotrophs are chemotrophs, which rely on inorganic chemical energy. Heterotrophs, by contrast, can neither photosynthesize nor harness inorganic chemical energy and must consume other organisms to obtain the energy they need.
Venus flytraps don't trap flies to obtain energy -- they obtain the energy they need through photosynthesis. They actually consume flies for nitrogen and other nutrients. This added nutrition is important because Venus flytraps naturally grow in nutrient-poor soils.