Prev | Current Page 688 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

MovieClip
{
public function startSpin()
{
var self = this;
onEnterFrame = function()
{
self._rotation++;
};
}
}
#end
When compiling the example, remember to add the switch - swf - lib library.swf so that the
library file is embedded in the resulting file.
A common mistake is to define a class in a package and to forget to define its full path in the XML file. If
the full name of your class is assets.effect.SpinningPicture , the clip attribute must have the
following format:
< clip id=???assets.effect.SpinningPicture??? import=???/picture.jpg???/ >
Many frames can be defined in a single clip and frames can be individually labeled so that the developer
can switch from one to another without necessarily using their indexes or stepping from one frame to the
next. In the following example, a hypothetic button is described using a different frame to represent the
various visual states that the button can assume. Because the PictureButton is the only class that is
Chapter 13: Replacing the Need for an IDE
367
also needed in the haXe code, the image clips are set externally to the library and they are invisible
outside the XML context.


Pages:
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700