  Aims: We characterize individual and ensemble properties of X-ray flares from
stars in the CygOB2 and ONC star-forming regions. Method: We analyzed X-ray
lightcurves of 1003 CygOB2 sources observed with Chandra for 100 ksec and of
1616 ONC sources detected in the ``Chandra Orion Ultra-deep Project'' 850 ksec
observation. We employed a binning-free maximum likelihood method to segment
the light-curves into intervals of constants signal and identified flares on
the basis of both the amplitude and the time-derivative of the source
luminosity. We then derived and compared the flare frequency and energy
distribution of CygOB2 and ONC sources. The effect of the length of the
observation on these results was investigated by repeating the statistical
analysis on five 100 ksec-long segments extracted from the ONC data. Results:
We detected 147 and 954 flares from the CygOB2 and ONC sources, respectively.
The flares in CygOB2 have decay times ranging from ~0.5 to about 10 hours. The
flare energy distributions of all considered flare samples are described at
high energies well by a power law with index alpha=-(2.1+-0.1). At low
energies, the distributions flatten, probably because of detection
incompleteness. We derived average flare frequencies as a function of flare
energy. The flare frequency is seen to depend on the source's intrinsic X-ray
luminosity, but its determination is affected by the length of the observation.
The slope of the high-energy tail of the energy distribution is, however,
affected little. A comparison of CygOB2 and ONC sources, accounting for
observational biases, shows that the two populations, known to have similar
X-ray emission levels, have very similar flare activity.
