Prev | Current Page 651 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

endFill();
}
}
This time many trees are produced at once; parameters have been changed on each generation. The
idea is to have brighter and shorter trees generated first and bigger trees on the front. The trees are also
disposed in a way that defines a visual perspective that is highlighted by the use of a gradient background.
The background is drawn once at the movie loading. The forest is generated and refreshed on
each click of the mouse. The forest generation is a CPU intensive process and can require some time to
complete. Figure 12 - 4 shows an example of forest generated using the code provided previously.
Extending the MovieClip Class
The MovieClip class provides some solid bases to build upon, but sometimes, using only the features
that it provides can lead to repetitive code. Extending the MovieClip class can be a good mechanism to
improve the code efficiency. Creating a subclass in Flash 9 does not show any difficulty and it is done as
for every other class hierarchy; unfortunately, in Flash 6 to 8 it is not that easy.


Pages:
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663