To what degree the cluster environment influences the sizes of protoplanetary disks surrounding young stars is still an open question. This is particularly true for the short-lived clusters typical for the solar neighborhood, in which the stellar density and therefore the influence of the cluster environment change considerably over the first 10 Myr. In previous studies,the effect of the gas on the cluster dynamics has oftenbeen neglected;this is remedied here. Using the code NBody6++,we study the stellar dynamics in different developmental phases-embedded, expulsion, and expansion-including the gas, and quantify the effect of fly-bys on the disksize. We concentrate on massive clusters (M cl 10 3 -6 * 10 4 M Sun ), which are representative for clusters like the Orion Nebula Cluster (ONC) or NGC 6611. We find that not only the stellar density but also the duration of the embedded phase matters. The densest clusters react fastest to the gas expulsion and drop quickly in density, here 98% of relevant encounters happen before gas expulsion. By contrast, disks in sparser clusters are initially less affected, but because these clusters expand moreslowly,13% of disks are truncated after gas expulsion. For ONC-like clusters, we find that disks larger than 500 au are usuallyaffected by the environment, which corresponds to the observation that 200 ausized disks are common. For NGC 6611-like clusters, disksizes are cut-down on average to roughly 100 au. A testable hypothesis would be that the disks in the center of NGC 6611 should be on average ≈20 au and therefore considerably smaller than those in the ONC.